- Home /
Setting UI Image Sprite via Script Prevents Color Change from Registering
I have an array of UI Images called upgradeButtonImgs
I call
upgradeButtonImgs[i].sprite = singleSelection.upgradeSlotSprites[i];
to set the sprite of one of those images to a specific sprite. Then I conditionally call
upgradeButtonImgs[i].color = Color.gray;
to visually show if the button is disabled. However, this has no visible effect until I manually go into the inspector and change the image sprite again, at which point the color change registers.
If I don't change the image sprite via script, the color change part of the script works properly. What is going wrong, and how do I fix it? Thanks!
Comment
Your answer
Follow this Question
Related Questions
compress photos on import 0 Answers
Draw a Sprite Round 1 Answer
Can't get various different sprites to change on a UI *Image*. 0 Answers
UI Image has no sprite definition 0 Answers
Image vs Sprites performance 1 Answer