Advertisement
Guest User

Untitled

a guest
May 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class ButtonClick : MonoBehaviour
  7. {
  8. public void Start()
  9. {
  10. var thisButton = GetComponent<Button>();
  11. var logic = GetComponent<IMagic>();
  12. thisButton.onClick.AddListener(() =>
  13. {
  14. if (logic != null )
  15. {
  16. MagicCreate.instance.OnMagic.RemoveAllListeners();
  17. MagicCreate.instance.OnMagic.AddListener(logic.MagicInstance); //() => { Debug.Log(name); })
  18. }
  19. });
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement