Log in or register to post comments

Android Camera not turning on second time

November 16, 2015 - 2:44pm #1

Hi guys.

 

We are seeing an issue on Android/Unity similar to many discriptions as the "black screen"  however it is on the second time the user accesses the AR. 

To replicate:

 

1)  User launches the app, goes to our main menu

2)  User jumps into "AR Mode" plays with our sample

3) User exits AR mode back to our main menu

4)  User returns to AR mode, and the camera doesn't appear to turn on.

 

If you kill the app, and restart (or reboot the device) the process starts over.

 

Unity 5.2.2f1 and Vuforia 5.0.5

Our app is on the Play store:  

 

https://play.google.com/store/apps/details?id=com.TornMedia.WPSample

 

EDIT:  appears to happen on iOS too, but on the third pass.

Our guess is a memory leak of some sort.  Are we missing a method to shut down the AR cleanly?  The app is broken into 3 scenes, main menu, AR, and puzzle scene.

 

Thanks!

Android Camera not turning on second time

September 19, 2019 - 11:41am #3

The method is obsolete. How can I solve the problem in 2019?. I have tried:

public class DontDestroy : MonoBehaviour

{

    //public GameObject ARCamera;

    void Awake()

    {

        GameObject[] objs = GameObject.FindGameObjectsWithTag("MainCamera");

        DontDestroyOnLoad(this.gameObject);

    }

}

but still doesnt work

Android Camera not turning on second time

December 2, 2015 - 3:54pm #2

Shouldn't be necessary to destroy the AR objects when leaving the scene as Unity itself will unload the scene. Try these steps:

  • Create new Unity project
  • Import ImageTargets 5.0.5 sample app
  • Create 2 additional scenes
  • Add UI buttons to all 3 scenes which allow you to interactively navigate between them
  • Use Application.LoadLevel() to switch between the scenes
  • Observe if ImageTargets scene camera is black on multiple reentries

 

Log in or register to post comments