- Home /
activate script using trigger
i am trying to make a capture the flag game but i was wondering weather u could activate a following script by using a trigger
Answer by FTheCloud · Aug 09, 2011 at 11:08 PM
Yep:
//gameObject that contains the script var Whatever : GameObject;
function OnTriggerEnter (other : Collider) { //You'd replace ScriptName with whatever the name of the script your trying to activate var scriptname : ScriptName = Whatever.GetComponent("ScriptName"); scriptname.active = true; }
Make sure that the script you want to activate is not active when you start your game.
Answer by gianni123 · Feb 24, 2012 at 05:40 PM
hi, the script of FTheCloud gives me this error "The name 'ScriptName' does not denote a valid type ('not found'). "" what's the type for script? thanks!
Answer by bighouse25 · Jun 30, 2013 at 02:00 PM
wow, this one can be painfull to figure out... the type needs to be the name of your script, that 2nd place it says ScriptName... it goes there to.
Your answer
Follow this Question
Related Questions
Activate script when player enters trigger zone. 2 Answers
script countdown 2 Answers
activate audio / animation on trigger 2 Answers
activate script from trigger 1 Answer
Trigger activation? 1 Answer