- Home /
UI Image.Color Not Changing the GameObject In-Game
I have a script that turns items a red-tint whenever it is dragged on top of a pre-occupied space in the inventory. The script works for one of my test items (the potion) but not the other (the coins), even though they use the same scripts. As you can see in the image provided, the inspector shows the Image.Color is correctly changing when dragged on top of another item, but this is not represented in-game for some reason?
The only difference between the two items is that the coins have multiple sprites that it can be depending on how many coins are in the stack. However, I do not see how this would affect the item changing color as even with different sprites the Image component is always the same. I am using IDragHandler and OnTriggerEnter/Exit2D to make these systems work.
This has really stumped me for the last 3 days so any tips or ideas are greatly appreciated. Thanks!
Answer by JamieRoss95 · Apr 24, 2019 at 02:38 AM
I was able to solve this issue by changing Image.spite to Image.spriteOverride. Not sure 100% why this fixed it, but hopefully this can help anyone else who runs into this issue.