Change colors for beginners
How can I change the color of a button via script? I know, that this was aked 100000000 times but nothing worked. here is an image: http://www.pic-upload.de/view-29482983/Screenshot1.png.html
If I click "Nächste Runde" the Script -ChangeColor" shall change the color of the first button to red.
Hi, please post the contents of your script so we can help you fix it.
Answer by SterlingSoftworks · Jan 19, 2016 at 08:07 PM
In the script create a public Image firstButton; variable.
Then in the inspector an empty field called "First Button" should be available. Drag the button in your hierarchy that you want changed into that empty field.
NOW, in your script where the button is supposed to be changing color.. Put in firstButton.color = Color.red;
Hope this helps :)
Your answer
Follow this Question
Related Questions
Shake UI Image/Gradually Change Color 1 Answer
Location Does Not Change 1 Answer
Is it possible to transition LUT over time 0 Answers
separate the items of an array with lines 1 Answer
Instantiated Buttons to have separate On-click functions 0 Answers