Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warp to ground freeze Unity #97

Open
gabry90 opened this issue Apr 17, 2019 · 2 comments
Open

Warp to ground freeze Unity #97

gabry90 opened this issue Apr 17, 2019 · 2 comments

Comments

@gabry90
Copy link

gabry90 commented Apr 17, 2019

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

@AkashaP
Copy link

AkashaP commented Sep 1, 2019

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.

@prime31
Copy link
Owner

prime31 commented Sep 1, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants