Using AR as a Spectator View for a Normcore Unity XR App
Jennifer Wang, May 2022
This is a tutorial to set up an AR spectator view in Unity Multiplayer with Normcore to an XR app.
Learn more about Normcore at their website or here.
There are plenty of tutorials around that can help you get a VR game set up in Unity using the XR Interaction Toolkit, so this tutorial will mainly focus on integrating Normcore and assumes you have already set up your project with the XR Interaction Toolkit: (Note: 0:00-3:52 of the youtube tutorial linked above gets you set up with the XR Interaction Toolkit in Unity.)
(Download a custom Unity Template for VR that will save you from having to set up XR Interaction Toolkit manually each time)
Software: Unity 2019+, XR Interaction Toolkit, Normcore
Hardware: Quest 2 Headset, Windows or Mac + headset charging cable
Add the Android Built Support and iOS Built Support as modules to your Unity Version
Use Package Manager to import AR Foundation and either the ARKit XR Plugin (iOS) or the ARCore XR Plugin (Android).
save a copy of your Realtime + VR Player scene to use for your AR Spectator app
In your AR Spectator app, swap the Main Camera for one that supports AR. Drag the “AR Foundation Camera Rig” prefab from the Examples > VR Player (Spectator) > Prefabs folder into the scene. This prefab contains the scripts needed to position the AR Camera, display detected planes, and finally place the origin of the world on an AR plane. It also includes a Camera object, so we can go ahead and delete the Main Camera game object from the scene.
In your AR Spectator app, connect RealtimeAvatarManager to our camera rig so the avatar uses the phone’s camera position in VR. You can do that by dragging the AR Camera into the Head slot on RealtimeAvatarManager.
Export a build for your device.