Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Malharhak on May 03, 2014, 02:17:49 PM

Title: Having the atlas/sprite selector in a custom component
Post by: Malharhak on May 03, 2014, 02:17:49 PM
Hello,

My problem is simple: I'd like one of my component to display the atlas and sprite selector, just like the UISprite component does.

I've seen a few things while searching with editor scripts but I have no idea how to make it work

I also found this thread (http://www.tasharen.com/forum/index.php?topic=4656.0) which I think is the same problem as mine but there is no context and I don't understand what to do with the example script. Where do the variables come from, where should the callback be defined, what's to do in it?

If anyone has a full example of how to do this or knows how I could display the sprite selector in my inspector it would be cool.
Thanks
Title: Re: Having the atlas/sprite selector in a custom component
Post by: ArenMook on May 04, 2014, 10:46:22 AM
NGUIEditorTools.DrawSpriteField will draw you a sprite selection field. You will need to do a search in the project to see how it's used, but it's pretty straightforward. Just call it from your inspector GUI.