Create a drag and drop element in the custom editor for textures.

Hey there,

If you have a game object that has a script that has a texture, you can drag a texture from the asset panel onto the texture variables text box thing and it will apply that texture.

I wish to create something like that for my own custom editor, but when I use:

Script.m_Texture = (Texture2D)EditorGUILayout.ObjectField("Texture", Script.m_Texture, typeof(Texture2D), true);

It comes up with a big ugly texture box.

Does anyone know how to recreate the texture box in the default inspector?

Additionally:
When you create an EditorGUILayout and pass in a blank GUIStyle, EVERYTHING disappears. How do you get the icons on the right hand side of a (for example) drop down list to show up again? I can’t figure out which part of the GUIStyle controls those.

Thanks in advance!!

Okay. Both of these have been solved.

First problem:
Solved with SerializedProperty and using a property box.

Second problem:
Used a blank GUISkin.

I now have an exact replica of the texture box in the default inspector. Mission accomplished. If anywone has the same problem, I can go into more detail if needed. The answers are out there, though.