- Home /
Question by
PedroDoche · Jul 25, 2012 at 04:07 AM ·
collisioncarfunctionscommands
How to activate a script from a collision?
Hello I am in the final phase of my game more I just came across a small problem that can not resolve. It is a racing game, and I wish that when the car reached the end of the race was a script activated by a collision so that the player returns to the title screen. Sorry if it's more like asking them to leave the sample script. Thank you.
Comment
Answer by GC1983 · Jul 25, 2012 at 04:12 AM
At the finish line, create an object collider. In a script you could use function
function OnTriggerEnter(collision: GameObject )
{ if(collision.transform.tag == "Player") { ScriptReference.active = true; } }
And that should be it. Add whatever else you please. =)
Hope this helps.