Advertisement
Guest User

Untitled

a guest
May 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. using UnityEngine.Events;
  4. using UnityEngine.EventSystems;
  5.  
  6. public class MagicCreate :MonoBehaviour
  7. {
  8. public UnityEvent OnMagic;
  9.  
  10. public static MagicCreate instance;
  11.  
  12. private void Awake()
  13. {
  14. instance = this;
  15. }
  16. public void Update()
  17. {
  18. if (OnMagic != null && !EventSystem.current.IsPointerOverGameObject() && Input.GetMouseButton(0))
  19. {
  20. OnMagic.Invoke();
  21. OnMagic.RemoveAllListeners();
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement