Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

On resetting my level my game crashes, sometimes

$
0
0
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"); } } 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 only do this because I'm moving too fast or ANY reason i can figure out I've been trying to troubleshoot. 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?

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>