SHARE
TWEET

HotspotUpdated / Anthony / NextRealityNews HowTos

AnthonyC Apr 17th, 2017 128 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 && other.CompareTag("MainCamera"))
  14.         {
  15.             OnEntered();
  16.         }
  17.     }
  18.  
  19.     private void OnTriggerExit(Collider other)
  20.     {
  21.         if (OnExited != null && other.CompareTag("MainCamera"))
  22.         {
  23.             OnExited();
  24.         }
  25.     }
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top