Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: dohjoka on July 19, 2013, 07:29:08 PM

Title: Filled Sprites
Post by: dohjoka on July 19, 2013, 07:29:08 PM
Am new to NGUI , I liked the way you can change fill amount of a filled sprite in a game , I know I can do that manually in the inspector but how would I do it through scripting?
I am making a health bar and I want to make a script that reduces the the sprite due to damage.
I can't seem to get to that UIScript and to that fillAmount variable.

thanks.
Title: Re: Filled Sprites
Post by: ArenMook on July 20, 2013, 04:02:37 AM
UISprite.fillAmount (http://tasharen.com/ngui/docs/class_u_i_sprite.html#afaa06b09053632ff0f9dc01c885c007e)
Title: Re: Filled Sprites
Post by: dohjoka on July 20, 2013, 04:06:52 AM
Thank you ArenMook,

you may call me a noob but if I want to access this variable from an outside script how would I initialize all the components in order to do that ?

again I appreciate your help.
Title: Re: Filled Sprites
Post by: ArenMook on July 20, 2013, 04:09:09 AM
Same way you access any other component. You must get it first:

UISprite sprite = GetComponent<UISprite>();
sprite.fillAmount = 0.5f;