Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started 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.
-
UISprite.fillAmount (http://tasharen.com/ngui/docs/class_u_i_sprite.html#afaa06b09053632ff0f9dc01c885c007e)
-
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.
-
Same way you access any other component. You must get it first:
UISprite sprite = GetComponent<UISprite>();
sprite.fillAmount = 0.5f;