Author Topic: Having the atlas/sprite selector in a custom component  (Read 2523 times)

Malharhak

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Having the atlas/sprite selector in a custom component
« 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 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Having the atlas/sprite selector in a custom component
« Reply #1 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.