diff --git a/MiraAPI/Hud/CustomActionButton.cs b/MiraAPI/Hud/CustomActionButton.cs index 04102b3..16e72a4 100644 --- a/MiraAPI/Hud/CustomActionButton.cs +++ b/MiraAPI/Hud/CustomActionButton.cs @@ -3,6 +3,7 @@ using MiraAPI.Utilities.Assets; using UnityEngine; using UnityEngine.Events; +using UnityEngine.UI; namespace MiraAPI.Hud; @@ -95,7 +96,7 @@ internal void CreateButton(Transform parent) } var pb = Button.GetComponent(); - pb.OnClick.RemoveAllListeners(); + pb.OnClick = new Button.ButtonClickedEvent(); pb.OnClick.AddListener((UnityAction)ClickHandler); } diff --git a/MiraAPI/Patches/PlayerControlPatches.cs b/MiraAPI/Patches/PlayerControlPatches.cs index 97a7e84..f4f79ce 100644 --- a/MiraAPI/Patches/PlayerControlPatches.cs +++ b/MiraAPI/Patches/PlayerControlPatches.cs @@ -37,9 +37,9 @@ public static void PlayerControlFixedUpdatePostfix(PlayerControl __instance) foreach (var button in CustomButtonManager.CustomButtons) { - if (__instance.Data?.Role != null) + if (__instance.Data?.Role == null) { - return; + continue; } if (!button.Enabled(__instance.Data?.Role))