Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Has to go at the top of your file
- #pragma strict
- import System.Collections.Generic;
- //The list of colliders currently inside the trigger
- var TriggerList : List.<Collider> = new List.<Collider>();
- //called when something enters the trigger
- function OnTriggerEnter(other : Collider)
- {
- //if the object is not already in the list
- if(!TriggerList.Contains(other))
- {
- //add the object to the list
- TriggerList.Add(Other);
- }
- }
- //called when something exits the trigger
- function OnTriggerExit(other : Collider)
- {
- //if the object is in the list
- if(TriggerList.Contains(other))
- {
- //remove it from the list
- TriggerList.Remove(Other);
- }
- }
Add Comment
Please, Sign In to add comment