Unity freezing when OnPointerEnter event,Unity freezing when OnPointerEnter happens,Unity freezing when OnPointerEnter occurs

I’m working on a project for Cardboard that will allow the user to move by looking at the ground. I have a “Walk” script attached to the Player:

and a “Ground” script attached to a Plane that I’m using as the ground:111056-ground.png

For some reason, when I test the scene, Unity freezes when the pointer enters the ground. I’m new to this and have no idea why this is happening. Any help would be appreciated.

Your problem is while loop in FixedUpdate, you call walk() tons of time per frame, that’s why unity freezes.
Just replace “while” with "if " and it’ll be good.