Hi guys, I have a trigger that when I collide with it my light is triggered and flashes. I tried using wrap mode loop but it still just plays once, my code is below, does anyone know why this doesn’t work?
var myLight : Light;
function Start() {
myLight = GameObject.Find ("Alarm Light").GetComponent(Light);
myLight.enabled = false;
}
function OnTriggerEnter (other : Collider)
{
if (!AlarmSetOff)
{
myLight.enabled = !myLight.enabled;
myLight.animation["LightFlash"].wrapMode = WrapMode.Loop;
}
}
Just a question, is this alarm light just a spinning light/single object? If so, you don't even need an animation.
– NegagamesAlarm light is just the name of the light attached to the character that I want to flash. this script is also to do other thing like adding sound as well though :S hope this helps
– robounited"LightFlash" has to be attached to the object, and animated so that appears/stays and dissapears/flysOutOfBounds like you want it to. and loop that
– DryTearthe "LightFlash" animation is attatched to my light "Alarm Light" but it doesnt loop, how do I loop that
– robounited