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):
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).
I have exactly the same problem - once the script reaches SceneManager.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
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
You are a gentleman and a scholar good sir. I have wasted 3 days dealing with this exact same issue.
– 1jstofferI have exactly the same problem - once the script reaches
– angel1stSceneManager.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.2Almost 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.
– G-Locasso