It’s been like this for years, there are many thread with people trying to fix it and there’s even a bug report that’s been marked as “fixed” (even though it’s not - at least not in 2017.3.1f1). I contacted the support about it and according to them:
“…this is by design and it doesn’t seem like the behavior will be changed any time soon…”
What you can do about it:
Change the color back to “Normal” yourself
Set the button’s “Navigation” to “None”. This also means that you can’t use your keyboard or controller to navigate to or from the button and you won’t get a proper object from the EvenSystem (possibly even “GameObject.Find”). Also: “None” won’t fix it for touchscreens, I had to…
Set the highlighted color to the normal color
It sucks, I know. It’s probably best to contact the support and hope that they’ll end up fixing it if enough users complain.
Based of answers here : click
I wrote this code, it works with joystick and mouse;
(bug : if you click on the mouse and move the joystick at the same time, joystick navigation is not working anymore.)
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
// Class that prevents button from being in "Highlighted" state after being in "Disabled" state
public class ButtonBugFix : MonoBehaviour, IPointerExitHandler
{
// mouse event
public void OnPointerExit(PointerEventData eventData)
{
Fix();
}
// joystick and keyboard event
void Update()
{
if (Input.GetButtonDown("Submit"))
{
Fix();
}
}
// fix button state
public void Fix()
{
GetComponent<Button>().enabled = false;
GetComponent<Button>().enabled = true;
GetComponent<Animator>().SetTrigger("Normal");
}
}
Hey,
I’ve had a similar Issue, the only difference being that my button is set to Transition: Animation.
I fixed it by defining a “Normal” and a “Selected” Animation. Those just set the Properties of the button to look the way it did before being pressed.
hope this helps