I am trying to make a custom property drawer. I want to have a texture2d in the inspector window, and I want to be able to click it and open up a window, in a way similar to how you open up the color picker, or animation curve editor, where I can then do what I need to to set the properties values. Im new to using custom properties, and have been searching for ages for a solution, so any help would be greatly appreciated
just add: public Texture2D myTexture;
, save the script and you will have a texture field in the inspector, if this is what you wanted
Not sure quite exactly sure what you’re asking, but if you draw any field with PropertyField in a custom editor, it’ll use the appropriate drawer by default.
@vargata @GroZZleR Sorry, Ill try to be a bit more clear; When you click on the color picker in the inspector, it opens up a window where you can select the color variable value and it sets the value in the inspector. I want to dp somthing similar with a texture 2d where when I click it another window will open with the texture 2d displayed, with the end goal being that I can click somewhere on the window with the texture 2D and select that color to be the inspector propertys value.
Sure, it’ll require a lot of editor scripting to do that, so prepare for a lot of head scratching if you haven’t done it before. Here’s a primer on creating editor windows. You’ll also need to create a custom drawer, either for the component itself or a property drawer if appropriate, for the “clicking on an eye dropper in the inspector” style functionality.