- Home /
The question is answered, right answer was accepted
My Unity game randomly freezes with no error or warnings, HALP?
So ive been working on this game for a month now and i have just now realized that my game at random moments decides to freeze with no errors or warnings given in the console box and the only thing that unfreezes it is me triggering one of my animations which inst a great way to get this to work, so i was wondering if any of you guys could help me since ive been going crazy trying to figure out whats wrong with my game. I have a video so heres the link to it so you can see what i mean:
password to video: help
So, you can't make your character jump up and down anymore? Or is it just that the obstacles no longer spawn? What exactly is supposed to be happening that isnt
well no, what happens is that my player(the cube) just randomly stops moving forward and the only way for me to make it move again is by triggering one of the animations(jumping or crouching). I'm not sure what is causing my player to just stop moving forward.
Post all the scripts related to your player moving forward, and I'll give it a look
Answer by oStaiko · May 02, 2017 at 01:10 AM
The reason the animations fix the issue is because it moves the rigidbody up and down. The cause of the problem is somewhere in the physics aspects, but I'm not sure why. It could be the animations are getting stuck in the floor collider, or maybe the friction on the floor is too high? Can't really say which just from looking at it though.
An alternative would be to change your box collider to a trigger, and in update just clamp its position so it doesn't fall through the floor. After that, just use OnTriggerEnter() instead and it should work the same.
Answer by DrLlamastein · May 02, 2017 at 08:15 AM
There's probably an infinite loop somewhere in your code causing it to freeze.