- Home /
Question by
jasoncosma · Jun 26, 2012 at 06:17 AM ·
collisionmusicdeathrestart
Don't restart music on death
Here's my code:
function OnCollisionEnter(theCollision : Collision){
if(theCollision.gameObject.name == "Graphics"){
Application.LoadLevel("Scene1");
}
}
How do I make it so when I die the music doesn't restart?
Comment
Answer by fafase · Jun 26, 2012 at 06:23 AM
So, the code you gave is supposed to act as a death collision. Instead of restarting the whole scene simply put your character back to the initial position.
Lets say you start at (0,0,0):
function OnCollisionEnter(theCollision : Collision){
if(theCollision.gameObject.name == "Graphics"){
transform.position = Vector3(0,0,0);
}
}
And this is attached to your player
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to restart the level upon cantact 1 Answer
My Player dies only when he wants to?!? 1 Answer
help needed: death on collision, fade then restart 1 Answer
How to destroy bullet on collision! 2 Answers