Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Button colors (hover effects) not working

Discussion in 'UGUI & TextMesh Pro' started by tugrulsubekci, Oct 31, 2023.

  1. tugrulsubekci

    tugrulsubekci

    Joined:
    May 30, 2022
    Posts:
    5
    I subclassed the button class and I wrote a new one but buttons are remaning "selected". How can I fix this?. You can see the problem in the attached images

    Code (CSharp):
    1. [CustomEditor(typeof(Sugar_Button))]
    2. [CanEditMultipleObjects]
    3. public class Sugar_ButtonEditor : Editor {
    4.     public override void OnInspectorGUI() {
    5.         DrawDefaultInspector();
    6.     }
    7. }
    8.  
     
  2. tugrulsubekci

    tugrulsubekci

    Joined:
    May 30, 2022
    Posts:
    5
    Okey I found the problem. Hover effects are working properly. I was calling base.OnPointerEnter(eventData); in OnPointerExit(PointerEventData eventData)

    Code (CSharp):
    1.  
    2.     public override void OnPointerExit(PointerEventData eventData)
    3.     {
    4.         base.OnPointerEnter(eventData);
    5.  
    6.         if(showInfo)
    7.             CloseInfo();
    8.     }