Hi there, this is my restart button code
Restart_Button_L1.js
function Start()
{
if (C1.Collided == true && C2.Collided == true)
{
return false;
}
}
function OnMouseDown ()
{
Application.LoadLevel("Level_1");
}
And this is my collider script for C1 ( C2 just change the object_1 to object_2)
C1.js
static var Collided = false;
function OnTriggerEnter (col : Collider)
{
if(col.name == "Object_1")
{
Collided = true;
print ("Hit Object_1");
}
}
function OnTriggerExit (col : Collider)
{
if (col.name == "Object_1")
{
Collided = false;
print ("Object_1 Left");
}
}
After i pressed restart button, my scene will jump back to level 1 but after that my game just win straight away, i already set my bool to false in restart button script but why it still just win the game straight away? how can i fix this problem?