Search Unity

Camera on XRCameraSubsystem is null after ARSession.Reset()

Discussion in 'Handheld AR' started by Matthias-Jantowski, Sep 7, 2018.

  1. Matthias-Jantowski

    Matthias-Jantowski

    Joined:
    Jan 4, 2014
    Posts:
    2
    In our mobile app we turn ARFoundation on and off. We also turn off the camera of the "camera Subsystem".

    Code (CSharp):
    1. ARSubsystemManager.cameraSubsystem.Camera.enabled = false / true;
    Unfortunately, the camera is apparently no longer set after a reset of the entire session (ARSession.Reset()), so that no access is possible.

    Are we doing something wrong or is this a bug?
     
  2. tdmowrer

    tdmowrer

    Unity Technologies

    Joined:
    Apr 21, 2017
    Posts:
    547
    The Camera property is set by the ARCameraBackground component each frame. If you've reset the ARSession, it may take a frame or two before it is non-null again.

    What are you trying to accomplish by disabling the Camera component?
     
  3. Matthias-Jantowski

    Matthias-Jantowski

    Joined:
    Jan 4, 2014
    Posts:
    2
    In our project several cameras exist for different processes. For example. Vuforia, or a GyroCam. In order to activate the switching between the different modes, we deactivate not only the respective systems, but also the cameras.

    Is it possible to delete only the found planes?

    First, the ARSession.Reset () takes quite a long time on mobile devices, and second, the planes are sometimes displayed incorrectly or "floating" when ARFoundation is turned on again. Therefore, it is my intention to disable the system on switch and at least delete the planes from found trackables.

    Thank you for response.
     
  4. vinnie-vivace

    vinnie-vivace

    Joined:
    Jan 12, 2010
    Posts:
    35
    @Matthias-Jantowski did you make any progress on this?

    I have a slightly different issue, where i am using ARSession.Reset() which seems to work once, but the second attempt crashes the app... so looking for alternatives until I hear back from Unity on this potential bug. (ARFoundation and ARCore XR Plugin)