So this script just checks after every movement if Im still on a cube on the grid. Now only SOMETIMES when the level is reset my game keeps resetting I assume because my boolean doesn’t change. It doesn’t do this because I’m moving too fast or ANY reason i can figure out I’ve been trying to troubleshoot doing the same thing over and over but only sometimes it happens at random occasions. It also sometimes locks up when I move to a different scene. In the hierarchy all my game objects are deleted and says “deleted gameObject” Any Ideas?
var floorCol : boolean = false;
function OnCollisionEnter(coll: Collision){
if(coll.gameObject.tag=="floor"){
floorCol=true;
}
}
function OnCollisionExit(coll: Collision){
if(coll.gameObject.tag=="floor"){
floorCol=false;
}
}
function Update(){
if(floorCol == false){
Debug.Log("reset");
floorCol=true;
Application.LoadLevel(Application.loadedLevel);
}
else if(floorCol==true){
Debug.Log("no reset");
}
}