do i create a new question or reply to the answer?
i looked more at the quirk on the buttons and not sure how to fix it other than creating an animation for the normal state. The navigation is set to none in everything i could find, even the sliders.
I downloaded version 5.3.8f2 and loaded the final scene from the project files and it also has the same problem.
i searched in google, an some suggested using EventSystem.current.SetSelectedGameObject(null); but it doesn´t seem to work. i tried it on the button events and on the update method.
For follow up questions you can continue posting in the original "thread", but posting a new question is fine as well.
So I tested this out myself and it does indeed stay in that state. In this case the issue is the animations. There are a few fixes for this. The reason why it stays that way is because right when we press the button we disable the entire group. So the animation never gets to finish out and leaves the button in it's last state. Note the scale at 1.3, which is the last keyframe of the pressed state.
An easy "fix" is to set the pressed state ending at the same state as the normal state, or in this case at a scale of 1. The more complex way is to have a unique method that disables the button component instead of the entire group which would require an array or manually disabling all the button components individually.
moving the scale to 1 works if i wait for the animation to finish before releasing the button, otherwise it still stores the last value used.
i tried another approach, i added a canvasgroup component to the empty objects. Then used the 3 values to hide the buttons instead of disable the group. There is still a bug in unity and using a delay between setting blockraycast=false and the other 2 parameter seem to work...
https://forum.unity.com/threads/clicking-a-button-leaves-it-in-mouseover-state.285167/
public void OptionsButton ()
{
EventSystem.current.SetSelectedGameObject(null);
StartCoroutine(DelayedDisableCanvasGroup(startMenu));
EnableCanvasGroup(optionsMenu);
}
void EnableCanvasGroup(CanvasGroup cg)
{
cg.blocksRaycasts = true;
cg.interactable = true;
cg.alpha = 1;
}
IEnumerator DelayedDisableCanvasGroup(CanvasGroup cg)
{
cg.blocksRaycasts = false;
yield return new WaitForSeconds(0.01f);
cg.interactable = false;
cg.alpha = 0;
}