UI Image

This does not work:
UIStamina.GetComponent().fillAmount = .5f;

Trying to set the fill amount of an image component from a specified gameobject to .5f. Not working, how can I fix this?

The thing is, the new unity documentation has this:

Image image = GetComponent();

but, for some reason my MonoDevelop sees “Image” as an error. I have the most up to date version of Unity and MonoDevelop on my computer, but I also have the old versions as well. I am indeed running the most updated verions of both.

SOLVED:

you need this:

using UnityEngine.UI;

1 Like

Thank You!!