void OnCollisionEnter( Collision other)
{
if(other.gameObject.tag == “lethal”)
{
Destroy (gameObject );
GM.zVelAdj =0;
Instantiate (boomObj,transform.position,boomObj.rotation);
GM.lvlCompStatus =“Fail”;
}
}
this code is in the player script.
and in GM i have this code.
![`timeTotal += Time.deltaTime;
if (lvlCompStatus == "Fail")
{
waittoload += Time.deltaTime ;
}
if(waittoload >2)
{
Application.LoadLevel("LevelComp");
}`][1]
Now i have three scene 1 is main menu which has play and quit button.
2 is the game in which the all the scripts are interlinked.
3 is level comp scene which has some scores counts and restart and quit button.
when player finishes the game by reaching the endpoint. after that if i restart then it runs fine.
but if the player is destroyed and if i restart the game. then the camera doesnt move and the game stops in may be 2 or 3 seconds and loads the level comp scene.
camera movement is sync with the player movement.
void Update ()
{
GetComponent <Rigidbody> ().velocity = new Vector3 (0,GM.vertVel,4*GM.zVelAdj);
}
as you can see in the images the problem .
so how can i reset every thing for the game level scene. when i restart the game.