Answer the question
In order to leave comments, you need to log in
UNITY NGUI Sprite fill amount?
Faced a problem. How to influence the fill amount from NGUI through a script. The script hung on the player. He must be responsible for health. Everything is working. But when it comes to the visual part, I can’t influence the sprite in any way. Help! How to influence him!?
Answer the question
In order to leave comments, you need to log in
Get a reference to the UISprite component and change its fillAmount parameter. Like this:
using UnityEngine;
public class Test : MonoBehaviour
{
public UISprite healthSprite;
private void Awake()
{
healthSprite.fillAmount = 1;
}
private void Update()
{
healthSprite.fillAmount -= 0.01f;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question