XR

Session Manager

The session manager is part of the XRManager instance and can be accessed via xrManager.sessionManager.

Properties

PropertyTypeDescription
modeXRSessionMode(Read-only) Gets the current session mode
stateXRSessionState(Read-only) Gets the current session state
supportedFrameRateFloat32Array(Read-only) Gets the hardware-supported frame rates
frameRatenumber(Read-only) Gets the hardware-running frame rate

Methods

MethodDescription
isSupportedModeChecks if a session mode is supported. Developers can use this to verify environment compatibility before starting a session. Parameters: AR or VR
addStateChangedListenerAdds a listener for session state changes. The callback will be triggered when the state changes, with the latest session state as the parameter.
removeStateChangedListenerRemoves a session state change listener
runRuns the session
stopStops the session

The XR session has five states: None, Initializing, Initialized, Running, and Paused. The state transitions are shown in the diagram below. After entering an XR session, developers can run or stop the session at any time. This state does not affect the engine's run and pause states.

Was this page helpful?

On this page