- Home /
How do I respawn my character after I die?
I am making a game in which my main character is a PlayerCar and once a demon hits it, it "dies" and will respawn at the starting point. I have tried all kinds of scripts but it doesnt work and when I die, it takes me to a blank screen.
Answer by Em3rgency · Jun 22, 2015 at 03:44 PM
If you only want to go back to the start on death, that is very easy to do. Find the script that handles your car death and instead of destroying it or whatever, move it to the start and reset any variables (like health).
vector3 startPosition = new vector3(0f,0f,0f); //Center of the world
//Something happens to make the car die
//...
//...
car.transform.position = startPosition;
car.health = 100f;
car.fuel = 250f;
//reset any other variables here
If just moving the car to the start is not enough, you will have to show us some code that you have, so we can help you.
Your answer
Follow this Question
Related Questions
Best program for 3D characters? 1 Answer
thrid person help 1 Answer
How to make the character change to another? 1 Answer
Character don't die 2 Answers