Hi,
I want to start XR manually at runtime, so I unchecked “Initialize XR on Startup”.
Downloaded the sample scenes from Github: GitHub - Unity-Technologies/arfoundation-samples: Example content for Unity projects based on AR Foundation
Picked the Simple AR Scene, and when I run the StartXRCoroutine coroutine from the source below, I get nothing but a black screen:
Advanced configuration for plug-in management | XR Plugin Management | 4.4.1
public IEnumerator StartXRCoroutine()
{
Debug.Log("Initializing XR...");
yield return XRGeneralSettings.Instance.Manager.InitializeLoader();
if (XRGeneralSettings.Instance.Manager.activeLoader == null)
{
Debug.LogError("Initializing XR Failed. Check Editor or Player log for details.");
}
else
{
Debug.Log("Starting XR...");
XRGeneralSettings.Instance.Manager.StartSubsystems();
}
}
Even though XCode seems to be fine:
Initializing XR...
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
<StartXR>d__6:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.XR.Interaction.Toolkit.UI.UIInputModule:ProcessPointerButton(ButtonDeltaState, PointerEventData)
UnityEngine.XR.Interaction.Toolkit.UI.UIInputModule:ProcessTouch(TouchModel&)
UnityEngine.XR.Interaction.Toolkit.UI.XRUIInputModule:ProcessTouches()
UnityEngine.XR.Interaction.Toolkit.UI.XRUIInputModule:smile:oProcess()
// 2D joint skeleton
enum JointIndices
{
Invalid = -1,
Head = 0, // parent: Neck1 [1]
Neck1 = 1, // parent: Root [16]
.....
}
// 3D joint skeleton
enum JointIndices
{
Invalid = -1,
Root = 0, // parent: <none> [-1]
Hips = 1, // parent: Root [0]
.......
}
[Subsystems] Loading plugin UnityARKit for subsystem ARKit-Input...
[Subsystems] UnityARKit successfully registered Provider for ARKit-Input
[Subsystems] Loading plugin UnityARKit for subsystem ARKit-Meshing...
[Subsystems] Failed to initialize subsystem ARKit-Meshing [error: 1]
Starting XR...
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
<StartXR>d__6:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
The only issue I noticed above is the [Subsystems] Failed to initialize subsystem ARKit-Meshing [error: 1] part. I wonder if it affects anything.
How can I start XR manually at runtime?
Unity 2023.2.3f1. iPhone 11. iOS 17.2.1
Custom project AR Plugin versions: AR Foundation 5.1.1. ARKit 5.1.1.
AR Foundation Samples Github Project AR Plugin versions: 6.0.0-pre.5
Thanks.