Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: vallcrist on January 17, 2014, 08:34:56 PM
-
Hello there.
One of my buttons ( fullscreen button ) has 2 states, my script currently exchanges between those states by changing the spriteName property of the UISprite, this works well except for the fact that i need to type in the sprite name in the inspector, which is kinda error prone as one can easily mistype something or mistake the case of the word..
Is there any way to add the sprite selector which NGUI uses to a script i make, without having to create a custom inspector for it?
-
Have a look at NGUIEditorTools.Draw series of functions. NGUIEditorTools.DrawSpriteField for example.
-
Hmm, thanks for the tip.
I'm currently trying to create a PropertyDrawer for sprite selection, if I manage to do it i'll share it here, with your permission ofc.
EDIT:
managed to do something, barely, though. Seems like propertydrawers doesn't allow for GUILayout usage so i had to hack a little. here's 2 images showing how it's working.
Code : http://ctrlv.in/284626
Inspector : http://ctrlv.in/284625