- Home /
OnTrigger outside the trigger and collider gamobject
I need to know if one of two or more triggers is touching environnement colliders in the same sript wich is outside of the gameobject containing them, void OnTrigger seems to only detect for triggers inside the same gamobject as the script.
I wouldn't like to create a script for each trigger since the main script use variables and functions wich does things with those triggers. I could perhaps create a script in each triggers and put a bool in there and use it in the main script but it seems like a big waste of performance.
Answer by TheDarkVoid · May 10, 2014 at 05:43 PM
There is not real performance issue with creating a new script to do the job here, you can do this one of 2 ways. Having the script on the triggers store the information on it's collision status and your main script(your main script will need to have a reference to each trigger script) pull that info from it or having the trigger script send that info directly to your main script, though depending on your needs you may need some method of differentiating between the triggers in which case the first method would be best since you would have references to each trigger script in an array.