- Home /
Question by
halileohalilei · Aug 26, 2015 at 12:40 PM ·
c#androidunity 5
Unity Application.LoadLevel freezes the game on Android device
I'm developing a game using Unity. The game has a single level and after the player wins/loses, I simply want to reload the same scene. Here's the code I'm using:
private void OnLevelFailed()
{
IsGameStarted = false;
Debug.Log("LEVEL FAILED");
Invoke("RestartLevel",5);
}
void RestartLevel()
{
Application.LoadLevel(Application.loadedLevelName);
}
When running this code on the editor, everything seems fine and the scene reloads as intended. However, when I build the game for Android and run it on a device (an LG G3), the game simply freezes. I used adb logcat to see the logs of any exceptions or errors if there were any but to no luck. I also suspected if the Invoke call was causing the problem and replaced it with simply the method call, but that didn't solve the problem either.
Anyone have any idea why this might happen?
Comment