Browse Source

Merge pull request #351 from FungusGames/button-click-null-check

Added null check in ButtonClicked event handler
master
Chris Gregan 9 years ago
parent
commit
4a8cb2432b
  1. 3
      Assets/Fungus/UI/Scripts/EventHandlers/ButtonClicked.cs

3
Assets/Fungus/UI/Scripts/EventHandlers/ButtonClicked.cs

@ -14,9 +14,12 @@ namespace Fungus
public Button targetButton; public Button targetButton;
public virtual void Start() public virtual void Start()
{
if (targetButton != null)
{ {
targetButton.onClick.AddListener(OnButtonClick); targetButton.onClick.AddListener(OnButtonClick);
} }
}
protected virtual void OnButtonClick() protected virtual void OnButtonClick()
{ {

Loading…
Cancel
Save