AnthonyC

Anthony / NextRealityNews HowTos

Apr 6th, 2017
320
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2.  
  3. public class Hotspot : MonoBehaviour {
  4.  
  5.     public delegate void HotspotEntered();
  6.     public static event HotspotEntered OnEntered;
  7.  
  8.     public delegate void HotspotExited();
  9.     public static event HotspotExited OnExited;
  10.  
  11.     private void OnTriggerEnter(Collider other)
  12.     {
  13.         if (OnEntered != null)
  14.         {
  15.             OnEntered();
  16.         }
  17.     }
  18.  
  19.     private void OnTriggerExit(Collider other)
  20.     {
  21.         if (OnExited != null)
  22.         {
  23.             OnExited();
  24.         }
  25.     }
  26. }
RAW Paste Data