Kanda Players 0.7.0
|
For XR to work correctly, there are some settings that need to be correctly configured. There are also some quirks of Unity DOTS that need to be considered. This guide will help you set up the essential requirements for XR players.
Supported XR runtimes need to be enabled in(Project Settings > XR Plug-in Management). This will result in platform-specific XR packages being imported to the project.
Initialize XR on Startup
to false.OpenXR
.OpenXR
.Apple visionOS
.Single Pass Instanced
Depth 16 bit
Oculus Touch Controller Profile
Meta Quest Touch Pro Controller Profile
Meta Quest Support
[Meta Quest Support] Using the Screen Space Ambient Occlusion render feature results in significant performance overhead when the applicaiton is running nativelyon device. Disabling or removing that render feature is recommended.
Virtual Reality - Fully Immersive Space
False
True
At the time of writing, there is a restriction that the Unity main camera cannot be in an entity sub-scene. For this reason, we need to make sure the camera is placed in the main GameObjects scene.
You can use the prefab provided in Runtime/Prefabs/MainCamera
.
Note that the template scenes come with a camera already, so you might not need to add one yourself.
To request initialization of the VR runtime, make sure the player entity has the RequestVrRuntimeStarted
component attached. This component will be discovered by the VrRuntimeClientSystem
which in turn will start the VR runtime and remove the component.
You can use the prefab provided in Runtime/Prefabs/Players/Local/LocalPlayerVrHead
.
The OpenXrInputCollector
collects input data from OpenXR devices. This collector is responsible for gathering Head Mounted Device (HMD) position and rotation data, which is needed for VR player movement and orientation.
To use OpenXR input:
OpenXrInputAuthoring
component.OpenXrInputSystem
will automatically populate OpenXrInputData
components with the latest input data from OpenXR devices.OpenXrHeadMovement
component and OpenXrHeadMovementSystem
to apply the collected input data to your VR player's head entity.For more detailed information on input collection and usage, refer to the PlayerInput" page.
To facilitate development and testing of VR functionality without always requiring an XR headset, this package provides options to mock XR input in the Unity editor.
To imitate an OpenXR device in the editor:
PlatformSettings.MockDevice
to true
.PlatformSettings.DeviceToMock
to AndroidOpenXr
.This configuration will:
Since macOS does not support OpenXR, a different approach is used to mock XR input:
PlatformSettings.MockDevice
to true
.PlatformSettings.DeviceToMock
to AndroidOpenXr
.KandaPlayerSettings.MockXr
to true
.This setting will:
With this virtual input collector:
These mocking options enable developers to test XR functionality and interactions without needing a physical VR device connected, making it easier to develop and debug XR features across different development environments.