Reply To: how do i fix the quirk about the button size not returning to its normal size ?

Forum Archive how do i fix the quirk about the button size not returning to its normal size ? Reply To: how do i fix the quirk about the button size not returning to its normal size ?

#25531

just for reference, this is what i did last

i added a canvasgroup component to the empty objects(starmenu, optionsmenu, levelmenu). Then used the 3 values to hide the buttons instead of disable the group. There is still a bug in unity in which the button still remains highlighted when using the canvasgroup(although if you move the mouse to hightlight other object it returns to normal). I am using one of the WA listed in the forums,  using a delay between setting blockraycast=false and the other 2 parameters. I am not sure if that is the best way to solve it but i can live with this for now.  

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;
}