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?
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?
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
Use a static var.