Guest User

reverbActivator | For Unity C#

a guest
Jul 18th, 2018
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class reverbActivator : MonoBehaviour {
  6.  
  7.     public GameObject objectToEnable;
  8.     // Put the reverb zone in the variable above (in the editor)
  9.    
  10.     private void OnTriggerEnter(Collider other)
  11.     {
  12.         // If the trigger is enetered, enable the "objectToEnable"
  13.         objectToEnable.SetActive(true);
  14.     }
  15.    
  16.     private void OnTriggerExit(Collider other)
  17.     {
  18.         // If the trigger is exited, disable the "objectToEnable"
  19.         objectToEnable.SetActive(false);
  20.     }
  21.  
  22. }
Add Comment
Please, Sign In to add comment