- Home /
If a ui button is clicked, you have to move the mouse off and click to revert to normal color or animation
what fixes this?
Comment
Best Answer
Answer by jenci1990 · Jan 17, 2015 at 03:34 PM
Add these lines to Start function of any script in your scene, or create a new script
void Start() {
Button[] allButton = FindObjectsOfType<Button>();
foreach (Button button in allButton) {
button.onClick.AddListener(delegate {
UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null, null);
});
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613180643im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Change the button target image alpha 1 Answer
How To Change Color Of Text On UI When It's Selected | Unity 4.6 3 Answers
Change the color of the Unity 4.6 buttons in code 2 Answers
UI Button color 1 Answer
How to have correct color on imGUI Buttons (as dynamic textures) avoiding multiply effect ? 1 Answer