Advertisement
AnthonyC

HotspotUpdated / Anthony / NextRealityNews HowTos

Apr 17th, 2017
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement