- Home /
Trigger Respawn
Hi. I'm making an air battle game. I wan't to make it so that when the plane gets hit by a missile or hits the terrain to respawn. Any help would be appreciated and i'm new to coding. Here is my code:
var spawn : GameObject;
function OnTriggerEnter(other : Collider)
{
if (other.tag == "plane")
{
other.gameObject.position = spawn.position;
}
}
Comment
Answer by lloladin · Jan 12, 2016 at 05:10 PM
function OnTriggerEnter(other : Collider)
{
if (other.tag == "plane")
{
other.gameObject.position = spawn.transform.position;
}
}
the problem seems to be that you wrote spawn.postion instead of spawn.transform.position
Your answer
![](https://koobas.hobune.stream/wayback/20220612055759im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I make a character die when he fells. 1 Answer
Trigger respawn after collision? 3 Answers
If trigger hit, spawn it 1 Answer
Activate trigger if items colected 1 Answer