AR Foundation scene starts using camera skybox

In the recent version of AR Foundation, for less than a second, a skybox will appear first, then the camera shows.

Which scene?

I think I may have found the culprit to this issue, I am subscribing like so:

void OnEnable()
    {

            UnityEngine.XR.ARFoundation.ARSubsystemManager.planeAdded += AddPlane;
    }

I’ll try to comment out all plane related stuff and run it again, noticed that this started happening after subscribing to events.

Is there anything that would slow down the AR camera initialising? I’m not doing anything else special. On iOS.

Do you have an ARPlaneManager? Plane detection is enabled or disabled based on whether there are any subscribers, and it is expected that you subscribe to its events rather than the ARSubsystemManager directly.

1 Like

do you have some example code we can use for this? I just guessed how this works tbh from sifting through references.

I’m going in like this:

using UnityEngine.XR;
using UnityEngine.Experimental.XR;
using UnityEngine.XR.ARExtensions;
using UnityEngine.XR.ARFoundation;


public class Sample : MonoBehaviour {

    public ARPlaneManager arpm;

    void OnEnable()
    {
            UnityEngine.XR.ARFoundation.ARSubsystemManager.planeAdded += AddPlane;

    }
    void Start () {
  arpm = GameObject.FindObjectOfType<UnityEngine.XR.ARFoundation.ARPlaneManager>();
    }
    public void AddPlane(PlaneAddedEventArgs eventArgs)
    {
        StartCoroutine(PlaneWait(eventArgs));
  
    }
    IEnumerator PlaneWait(PlaneAddedEventArgs eventArgs)
    {
        yield return new WaitForEndOfFrame();
        yield return new WaitForEndOfFrame();
        ARPlane thisPlane = arpm.TryGetPlane(eventArgs.Plane.Id);

        if (thisPlane.boundedPlane.Alignment == PlaneAlignment.Vertical)
        {
            print("vertical");
        }
        if (thisPlane.boundedPlane.Alignment == PlaneAlignment.Horizontal)
        {
            print("horizontal");
        }
    }

With the standard SampleScene contents