I am working on a small game that uses a “game over” screen that is displayed upon a collision with a pit (a cube with black material.) The cube itself has a rigidbody and box collider.
This is the script (Javascript) attached to my player (First Person Controller Camera, has a RigidBody and Capsule Collider with no trigger.)
function OnCollisionEnter(deadPlayer : Collision)
{
if (deadPlayer.gameObject.tag == "Pit")
{
Destroy (gameObject);
Application.LoadLevel("deathPit");
}
}
The player properly collides with the cube, rather, it acts as a floor. But the level specified in the last line is not loaded, and I stay in the bottom of the pit until I exit the game.
Any help would be appreciated. :c