- Home /
change button and text color together
It is possibile with a script attached to text of a button change the color of the two elements together? I am using the new UI system.
S.
Answer by alexi123454 · Jul 20, 2015 at 08:13 PM
Are you referring to the "fade" effect that you get when hovering or clicking a button? If so, you could just make a script that gets the current color of the button and applies it to the color of the text.
If you mean just changing the color of the two elements at the same time, you could make a script that has a specific color, and apply that color to the two elements (if the script is on the Text gameObject, you could have the button as a variable, or call transform.parent.GetComponent())
Answer does not explain how to 'get the current colour of the button'. It's a great theory, but there doesn't seem to be an easy way to do that.