Skip to main content

An Image object cannot have a new Color object assigned without corrupting it

This could be due to a known engine bug.

Possible solution:

  • Use a pre-defined Color object's constructor.

For example change this:

Image img;
Color red;

void Start() {
img = GetComponent<Image>();
red = new Color(255,0,0);

img.color = red;
}

to this:

Image img;

void Start() {
img = GetComponent<Image>();
img.color = Color.red;
}