From c2b8b39fa15bac7781344fccdb0b7c214e1807dc Mon Sep 17 00:00:00 2001 From: Gabriel Juchault Date: Wed, 21 Nov 2018 14:47:49 +0000 Subject: [PATCH] fix(cooldown-button): add a fake event to avoid null buttonSource --- Scripts/Controls/CooldownButton.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Scripts/Controls/CooldownButton.cs b/Scripts/Controls/CooldownButton.cs index 9d15ecd..502362b 100644 --- a/Scripts/Controls/CooldownButton.cs +++ b/Scripts/Controls/CooldownButton.cs @@ -144,9 +144,11 @@ namespace UnityEngine.UI.Extensions /// public void StartCooldown() { - OnCooldownStart.Invoke(new PointerEventData.InputButton()); + PointerEventData emptySource = new PointerEventData(EventSystem.current); + buttonSource = emptySource; + OnCooldownStart.Invoke(emptySource.button); cooldownTimeRemaining = cooldownTimeout; - cooldownActive = cooldownInEffect = true; + CooldownActive = cooldownInEffect = true; } ///