Crashing by using the Plugin in Multiple Unity Scenes


#1

hi, guys.
im using the SDK (StructureUnityUBT) on Unity (5.5.3f).
thx for nice SDK, i could enjoy my iPad VR system development.

But i always face a critical problem:
when i duplicate Example scene in UnityUBT Package as “Scene1” and “Scene2”, and change Scene1 to Scene2, my application crashes!!

In Unity, i just use SceneManager.LoadScene(“Scene2”) (SceneManager.LoadScene), without any memory release command or something.
I think the reasons are memory problems or something, but since i cant connect USB cable while using the Sensor (cuz the sensor occupies the port on ipad), i cant see debug logs on my app.

How can i make multiple scenes and use SDK in Unity without any crash?
Is there any proper memory release or other close commands on UnityUBT to use the SDK in multiple Scenes?


Self Solved

Thx for Unity Package’s Script message, i could solve this problem
solvency is like this:

  1. make a empty object as Parental Object
  2. set STPlayer and StructureStatusUI and other objects as child objects of a Parental object.
  3. attach the script bellow to the Parental Object to prevent from calling Initializer in “Scene2”
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

public class KeepObject : MonoBehaviour {

void Awake() {
DontDestroyOnLoad(this.gameObject);
}
}

then, after call SceneManager.LoadScene(), you can prevent from calling initializer and crashing your application.

Maybe, my failure before was to call the initialize method twice in Scene1 and Scene2.

Thx.