How to Respawn an gameObject when it touch another gameObject
I need some help on the game, and I can't find any useful script on YouTube or in any Website, I searched as much as I can to get help, my game is a racer game, and there are blocks you should jump on, if a player fall to the ground, I want him to respawn when touching the gameObject which it is the void, is there any script that respawn the player when he get in touch with a gameObject? Please reply, thank you
Answer by wertyq · Apr 16, 2020 at 01:15 AM
@BruteAsura This video pretty much tells you how to do exactly that https://youtu.be/VbZ9_C4-Qbo
You can use OnTriggerEnter() to handle collisions. Assuming you follow how they setup GameManager in the video, you can do something like this.
void OnTriggerEnter(Collider other)
{
if (other.name == "Void") //Make sure Void game object has the tag "Void" in the inspector
{
GameManager.EndGame();
}
}
I want to respawn them, It gives me an error, please reply
Your answer
Follow this Question
Related Questions
Player respawn at death position 0 Answers
Ragdoll death respawn help 0 Answers
Open door by completing all puzzles 1 Answer
GameObject is already being activated or deactivated 3 Answers