I have a script for a vertical progress bar using filled image but the image decreases (basically you can see the full image when the game starts and then it goes down, like a health bar) but since it's a progress bar I need it to increase (at the end I should see the complete image, not at first). This is the code:
public class ProgressBar : MonoBehaviour {
public Image Bar;
public float max_progress = 100f;
public static float cur_progress = 0f;
void Start () {
cur_progress = max_progress;
}
void Update () {
Bar.fillAmount = cur_progress / max_progress;
}
And I have ProgressBar.cur_progress -= 0.4f;
in the bullet script because it should increase everytime you kill an enemy.
I tried writing +=
instead of -=
but it doesn't work (the image is filled and it doesn't increase or decrease), and i think that is not incorrect so I don't know what the problem is. Thanks in advance.