Can't change the color of an Image

Hello,

I’m using the last beta version of Unity (2018) and I have an issue to change the color of an Image in my prefab.

I’m using my prefab “A” in 2 situations. The first time it works, then I load/destroy other prefabs and load my prefab “A” again and it doesn’t work anymore. I can’t understand why, Unity doesn’t give me any error. Step by step debugging doesn’t seem to indicate anything wrong. I can’t really describe everything I do between the 2 calls (activate/deactivate prefabs/gameobjects, call functions in external DLLs …). When I tried 2 days agothe step by step debugger was making Unity crash on that line. It’s fine now but the color is not changing.

my code is just :

this.backgroundImage.color = this.ColorRowHover;

where backgroundImage is an Image in a GameObject (not containing or linked to the current game object, it’s just a reference to another Image). and ColorRowHover is just a color. This code is called in the OnPointerEnter.

You can find attached the properties of the game object containing the image.

The color is not changing, and if I try to change it in the inspector it’s not changing as well. I pick the color and it’s not updating the property in the inspector nor on the display.

Do you guys have any idea what could be the issue here ? Or how to find more clues to debug this ?

To be more complete : My game object has a OnPointerEnter so that everytime the mouse enters that object a whole row behind will change color.


Thank you for your help :slight_smile:

Well, I would think the first thing to try is to just change it to a color like Color.Green or something. That should tell you if it’s a bug, or if you don’t have a color that’s different than what is on it.

1 Like

Hi,
Thank you for your answer !

Changing the color didn’t fix the issue.

I’ve also noticed the scrollbar of my component is not working (the size of the scrollbar seems right according to my viewport but I just can’t scroll neither with my mouse or by dragging the scrollbar. When I drag it the scrollbar moves but it doesn’t scroll).

So the issue might be more general and might concern my whole game when that prefab is activated.

Is there any tool in Unity to debug that ? Check if anything has crashed.

Thank you