Warp to ground freeze Unity
Hi, when call Warp To Ground method from other script in OnStart() function Unity freeze always after click play game.
During some debug i'll found the problem. In the while loop the movement still continue infinitly with IsGrounded always false.
This problem occur only when in the Unity Project settings Physics2D AutoSyncTransform is set to False. If turn it to True the problem not exists. But, i need to turn off this settings for some reasons in my project.
Thanks
I feel like the function is dangerous. If there is no ground (e.g void chasm) then it looks like the program will just freeze if called.
Either that, or if there's void below and platform above, it could freeze for a while and then the player eventually warps upwards due to underflow, which would be very confusing to both players and devs.
Might want to try code around that by explicitly checking whether moving downwards exceeds some lower boundary.
That is a good call. Perhaps if the method took in a maximum distance to check it could add a safety net. It’s main purpose was actually for an in-game editor that always had a ground underneath so there was never a worry of hitting the infinite loop.