Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: mremus on August 12, 2013, 09:30:44 PM

Title: Need help in swapping sprites using a variable that is attached to a panel
Post by: mremus on August 12, 2013, 09:30:44 PM
My title may not adequately describe what I am trying to do. In my NGUI UI I have a panel (ID_Panel), with a script attached. In the script I have a variable setup (var This_Panel_Object : GameObject;).  Over in the Inspector I dragged one of the sprites (Sprite_Sailboat) belonging to ID_Panel  into the Game Object slot so that when the game is running and the ID_Panel is active the sailboat sprite is displayed.

What I want to have happen is when the user clicks on another object (let's say a seagull) in the game, the sailboat sprite fades off and a seagull sprite (Sprite_Seagull) fades in.  I have the fade in and out part down I believe, but I am not sure how to code things so that the Sprite_Sailboat sprite in the This_Panel_Object variable gets replaced with the Sprite_Seagull sprite allowing the seagull sprite to be be displayed.  Hope this makes sense.
Title: Re: Need help in swapping sprites using a variable that is attached to a panel
Post by: ArenMook on August 13, 2013, 08:20:14 PM
I am not sure what fading sprites has to do with replacing panel object variables... Fading in is done via tweens. Replacing variables? That's your code.
Title: Re: Need help in swapping sprites using a variable that is attached to a panel
Post by: mremus on August 15, 2013, 09:11:22 AM
Thanks Aren for the reply.  I sorted it out and I apologize for any confusion. Had to just sit back and work through it after a night's worth of sleep.