- Home /
multiple targets and one trigger, is it possible?
I tried to make a trigger but I want multiple things to happen once in triggered. for instance, right now my trigger is activating the Target's animation, I want at least 6 more object's animations to be activated.
so do I need to create multiple triggers for that? or there is a shorter way to do it?
Answer by JoaquinRD · Aug 18, 2013 at 05:45 PM
You can do anything you want. It would help if you posted some code, but try this (I'm assuming that you're working in JavaScript):
var animationsToTrigger : Animation[];
function OnTriggerEnter(other : Collider)
{
for (int i = 0; i < animationsToTrigger.Length; i++)
{
animationsToTrigger[i].Play();
}
}
Then, just drag all of the animations that you want to trigger into the animationsToTrigger array in the inspector.
working with C#, but wow, I'm so ashamed I didn't think of that...........
Your answer
Follow this Question
Related Questions
Target touching enemy collision 1 Answer
Can't click gameobject when over another trigger? 1 Answer
OnTriggerEnter 1 Answer
OnTriggerEnter - Assign as a Target to Player Script 0 Answers
Multiple targeting help 1 Answer