Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: hgrenade on July 03, 2013, 03:23:26 PM

Title: UISprite.fillAmount
Post by: hgrenade on July 03, 2013, 03:23:26 PM
How do I set the fill amount for a progress bar. When I call this on my bar I get the following error:

  1. Assets/Scripts/UI/NGUI_Menus.cs(61,31): error CS1955: The member `UISprite.fillAmount' cannot be used as method or delegate

I am having a VERY hard time understanding how to script NGUI and I'll be honest, without being able to apply data dynamically to the UI its pretty much pointless. You did a great job listing out each method and property but you don't show examples of how to use it. Everything I try to do takes an hour of searching the internet and trial and error. Keep in mind I am a javascript/unityscript guy so this C stuff just doesn't make a lot of sense : ) Please list use case examples like they do on the Unity docs. thx!
Title: Re: UISprite.fillAmount
Post by: ArenMook on July 03, 2013, 04:01:59 PM
Exactly the same way you work with any Unity component. You have to get it first.
  1. UISprite sprite = GetComponent<UISprite>();
  2. sprite.fillAmount = 0.5f;
Title: Re: UISprite.fillAmount
Post by: hgrenade on July 03, 2013, 04:12:12 PM
haha yes I just figured that out! Thank you, I was over-thinking it. Samples would be extremely helpful for the n00bs : )
Title: Re: UISprite.fillAmount
Post by: hgrenade on July 03, 2013, 04:13:55 PM
FYI - I was calling it as a function : )

  1. myUISprite.fillAmount(0.5);