SceneManager.LoadScene is crashing or freezing for Android Devices
Hi guys.
Ok, I've been testing a game with several scenes. In Unity and iOS devices, everything works perfect. In Android, always crash (or freeze if you prefer).
I'm using Unity 2017.2.0f3. and the line of code that crash is the next one (nextScene is a string with the value of the next scene):
SceneManager.LoadScene (nextScene);
I've been trying other options like:
SceneManager.LoadScene (nextScene, LoadSceneMode.Single);
But this is not working neither. The last one I tried was:
SceneManager.UnloadSceneAsync(UIManager.Instance.currentScene);
SceneManager.LoadScene (nextScene, LoadSceneMode.Single);
Again without success. Please I really need help with this. I've dealing with this problem for 24 hours. It's driving me crazy.
Answer by tonOnWu · Oct 25, 2017 at 09:23 PM
After more than 24 hours I solve the problem. I hope that my solution help other people because there isn't enough references on the web. When I created the APK file it was splitter with a second one of type OBB.
This kind of files is required when the Android App is too big. In my case was set by default. The solution was to force the creation of the APK without the OBB. To do that you must get to Player Settings in Android, go to Publishing Settings and uncheck Split Application Binary (located at the bottom).
Everything's working now and life is good again.
You are a gentleman and a scholar good sir. I have wasted 3 days dealing with this exact same issue.
I have exactly the same problem - once the script reaches Scene$$anonymous$$anager.LoadScene("02");
, the Android app freezes. Unchecking the above checkbox however did not do the trick for me. Any other suggestions? I am using Unity 2019.2
Almost one week with problem, so hard to track it down. Thank you for your efforts and for the updated answer; couldn't find this approach anywere.
Answer by AKComp · Nov 26, 2017 at 11:32 PM
1-) Import this package to your project,
2-) Create new C# script and add this lanes to your main scene (Firstly loading scene)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class obbLoader : MonoBehaviour {
// Use this for initialization
void Start () {
if (PlayerPrefs.GetInt ("obbLoaded") == 0) {
GooglePlayDownloader.FetchOBB();
PlayerPrefs.SetInt ("obbLoaded", 1);
PlayerPrefs.Save ();
Application.LoadLevel ("MainMenu");
}
}
}
Hey, can you repost the package from the first bullet? Now it takes me to a 404 error page
Answer by AnisimovArthur · Feb 25, 2020 at 07:52 AM
Hey,
In my case the problem was in a camera in a scene. I change 'Target Eye' to none (main display) and 'clear flags' to Skybox.
Hope it will help!
Your answer
