Search Unity

Cardboard app crashes when loading a new scene

Discussion in 'AR/VR (XR) Discussion' started by ilonamarja, Jun 13, 2018.

  1. ilonamarja

    ilonamarja

    Joined:
    May 17, 2018
    Posts:
    9
    Hello!

    My cardboard app (build) crashes all the time when I try to load a new scene after completing level one. There's a sign in my scene and when I click on the sign it should load a new scene. This works perfectly on my PC but crashes on my mobile. The camera freezes after clicking on the sign, nothing happens and then i get a message "app stopped working". The "level 2" scene is lighter than the first one and the app size is 75MB. What might be the reason for crashing/freezing? The code for loading a new scene is:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.SceneManagement;
    4.  
    5. public class SignPost : MonoBehaviour
    6. {
    7.  
    8.     public void NewScene()
    9.     {
    10.  
    11.  
    12.         //Load new scene
    13.         SceneManager.LoadScene("01underwater");
    14.         Debug.Log("New scene loaded!");
    15.  
    16.  
    17.     }
    18. }
     
  2. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    Try stripping this down to the absolute simplest repro scenario. If the issue really is just scenes loading then have two scenes where the first scene simply waits a time interval and switches to the next scene. Continue adding complexity till you find the issue repros.
     
  3. ilonamarja

    ilonamarja

    Joined:
    May 17, 2018
    Posts:
    9
    I made another build and tried the app again (I changed the second level to an empty unity scene) and it didn't crash. What's the best way to script the time interval between levels? It seems that my second level is quite heavy.
     
  4. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
  5. ilonamarja

    ilonamarja

    Joined:
    May 17, 2018
    Posts:
    9
    The terrain in the second scene is the reason for crashing/freezing. I replaced terrain with a plane and the problem disappeared and the second scene loaded immediately. Why is terrain causing crashing? I optimized it for mobileVR, I increased the draw pixel value to 100 and the base map distance is 8. Heightmap resolution is also low.
     
  6. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    I can't really tell you why with just this. If you can capture logcat output from the device and see what the crash stack/information is like?
     
  7. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    Follow up Question: Does this crash happen if you disable VR?