- Home /
Make a PropertyField() for a Texture2D SerializedProperty looking like an ObjectField()
If I use a PropertyField()
to handle a Texture2D
in a custom editor, it looks like a generic object field, not a field with a texture visible inside of it.
How can I make the PropertyField()
of this Texture2D
showing like the ObjectField()
above?
I am using Unity 3.5.6f4.
Answer by Dakwamine · Jan 01, 2013 at 10:48 PM
For now, I have kept the PropertyField() and I added a side box containing the image thumbnail if all selected objects were using the same Texture2D.
Answer by fafase · Jan 01, 2013 at 11:27 PM
Would this help?
http://docs.unity3d.com/Documentation/ScriptReference/EditorGUILayout.ColorField.html
In fact, it is a stretched orange PNG texture in the Object field above, not a color. If I had set the height of the Object field box, it would be more obvious to see that it is a texture. But thanks for your help anyway.
(ColorField doesn't handle SerializedProperty too)
Your answer
Follow this Question
Related Questions
SerializedProperty to Texture2D 2 Answers
PropertyField problem 1 Answer
Editor Object Field Select From List 2 Answers
ObjectField functions ignoring parameter 1 Answer
Invalid iteration - (You need to stop calling Next when it returns false) 2 Answers