protected override void OnDestroy () {
			base.OnDestroy();
			OnClick.RemoveAllListeners();
			OnEnter.RemoveAllListeners();
			OnExit.RemoveAllListeners();
			OnPress.RemoveAllListeners();
			OnRelease.RemoveAllListeners();
			StopAllCoroutines();
		}
Example #2
0
 // Clean up this event listener and detach events.
 public void Dispose()
 {
     if (PointerDown != null)
     {
         PointerDown.RemoveAllListeners();
         PointerDown = null;
     }
     if (PointerUp != null)
     {
         PointerUp.RemoveAllListeners();
         PointerUp = null;
     }
     if (PointerClick != null)
     {
         PointerClick.RemoveAllListeners();
         PointerClick = null;
     }
     if (Drag != null)
     {
         Drag.RemoveAllListeners();
         Drag = null;
     }
     if (BeginDrag != null)
     {
         BeginDrag.RemoveAllListeners();
         BeginDrag = null;
     }
     if (EndDrag != null)
     {
         EndDrag.RemoveAllListeners();
         EndDrag = null;
     }
     if (Scroll != null)
     {
         Scroll.RemoveAllListeners();
         Scroll = null;
     }
     if (Pinch != null)
     {
         Pinch.RemoveAllListeners();
         Pinch = null;
     }
 }