Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: will_brett on December 29, 2014, 06:33:44 PM

Title: How to assign a sprite from a scriptable object?
Post by: will_brett on December 29, 2014, 06:33:44 PM
Hey all,

Im creating a scriptable object to manage a load of GUI shop items. The data in the scriptable object then modifies a template item.

My question is how do I define a sprite in a scriptable object? Would I do it as a string to the path of the sprite in the atlas and if so how?

Thanks

Will
Title: Re: How to assign a sprite from a scriptable object?
Post by: ArenMook on December 30, 2014, 02:10:37 PM
I am not quite clear on what you're asking. Are you asking how to assign a sprite? If so that's just sprite.spriteName = "Your Sprite". Or are you asking how to add a sprite to the atlas at run time? If so, that's not possible. Or are you asking how to add a new sprite to the scene? If so, NGUITools.AddWidget<UISprite>(parentObject).
Title: Re: How to assign a sprite from a scriptable object?
Post by: will_brett on January 01, 2015, 01:39:22 PM
Sprite.name = "yoursprite" should do the trick thanks