Explorar o código

Update YesNoObject.cs

Michael8818 hai 4 meses
pai
achega
6ed4fb3ebb
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      Assets/Scripts/Script/YesNoObject.cs

+ 3 - 3
Assets/Scripts/Script/YesNoObject.cs

@@ -26,10 +26,7 @@ public class YesNoObject : MonoBehaviour
         for (int i = 0; i < Buttons.Count; i++)
         {
             Buttons[i].OnClickAction = null;
-        }
 
-        for (int i = 0; i < Buttons.Count; i++)
-        {
             if (i < OnClickActions.Count)
             {
                 Buttons[i].gameObject.SetActive(true);
@@ -40,6 +37,9 @@ public class YesNoObject : MonoBehaviour
 
                 Buttons[i].OnClickAction = () => 
                 {
+                    if (!Buttons[k].GetComponent<Button>().interactable)
+                        return;
+
                     OnClickActions[k]?.Invoke();
                     
                     if(this.CloseOnButtonClicked)