Game/Engine Doesn't Respond after trying to Stop Player Input
Hey everyone!
I got a bug where if I wanted to stop all movement of the player when a fade in and out transition is happening, the game (and engine itself) locks up. Built an APK of the game too, and it froze. Any solution that I can use, and how did that problem happen too? Thanks!
And for anyone asking, I'm running Unity 5.5.4f1 on Windows, building on Android.
Warp.cs: https://pastebin.com/WFSKGUij
ScreenFader.cs: https://pastebin.com/2bBmzVPe
PlayerMovement.cs: https://pastebin.com/ba0BiFQD
Answer by Bunny83 · Jun 22, 2017 at 10:47 PM
Your while loops inside your ScreenFader class are missing their curly brackets. That means your code actually looks like this:
// [ ... ]
while (isFading)
{
Debug.Log("PlayerMovement.canMove = false; fadeout");
}
PlayerMovement.canMove = false;
Debug.Log("Starting yield (FadeToClear)");
yield return null;
// [ ... ]
Since your while loop can never finish and you don't yield inside the while loop your application is caught in an infinite loop.
Your answer
Follow this Question
Related Questions
Jumping Problems 0 Answers
player stays in spot while ship moves away 0 Answers
Check if the player is off/on the path. (3D; c#) 1 Answer