Hello, need a bit help, and here is my problem:
Simple time measure for multiple objects. I got in my scene 3 triggers. One is used for start and end of counting, other two are for split time measuring.
My question is, can I put these trigers in array and call them with index when needed? And is it needed that trigger script is on triggers, since multiple objects are going to pass them and I don’t wanna that every object so to say resets my trigger counting? Is it possible to attach trigger script to a moving object so it overlooks triggering for each object?
Cheers
Presumably you’d be better off putting the trigger script on the thing that is interested in being timed. Then when it enters a trigger you could look up a component you attached to the trigger and see what to do. In the code below you would attach TimingTrigger to each trigger and set the type. Then the TimedItem would detect the triggers and perform the timing logic
#TimingTrigger.js
enum TriggerType { start, stop, split }
var triggerType : TriggerType;
#TimedItem.js
function OnTriggerEnter(other : Collider)
{
var timing = other.GetComponent(TimingTrigger);
if(timing)
{
switch(timing.triggerType)
{
case TriggerType.start:
//Do something
break;
case TriggerType.stop:
//Do something
break;
case TriggerType.split:
//Do something
break;
}
}
}
Thanks m8, this is what I was looking for 
Cheers