reckfellENGINE

WebXRInterface

Browser XR: sessions, features, input and events.

On this page
class WebXRInterfaceReckfellSharpInherits XRInterface

Abstract browser WebXR API: session modes, features, input and events. The concrete registered interface named WebXR is created in a Web build. SDK-type availability in a desktop editor does not start browser XR. Current C# exporter 1.0.0 does not implement the Web target; this reference promises no C# Web export.

Subscribe before requesting. IsSessionSupported asynchronously reports through SessionSupported; it grants no permission and starts no XR session. Initialize sets initialized before request completion; wait for SessionStarted before enabling Viewport.UseXR. Restore prior UI/viewport on SessionEnded/SessionFailed. Use the borrowed registered interface without manually freeing it.

Apply settings before startup. RequestedReferenceSpaceTypes defines fallback order; ReferenceSpaceType reports the actual selection. EnabledFeatures may be empty if the browser provides no list. Input depends on source activity and pose data. Current code emits Select/Squeeze after the corresponding end event: avoid duplicate gameplay actions.

GetDisplayRefreshRate is not FPS. Rate requests are asynchronous; current JS does not convert rejected support/refresh promises into SessionFailed. Provide observable pending/error state. Rate functions use integer JS ABI; fractional values across WASM were not tested.

WebXR startup and diagnosis. JS function bodies were executed with mock browser/session/GL in Node; native callbacks, actual export, permissions, headset, input and pixels are not accepted as tested. Engine source and build were unchanged.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Properties8

DisableWebxrLayersProperty
# DisableWebxrLayers
C#
public bool DisableWebxrLayers { get; set; }

Stored WebXR Layers disable flag, initially false. Set before Initialize; true selects XRWebGLLayer fallback. Actual fallback can occur even at false because multiview/binding/createProjectionLayer is unavailable. The getter reports neither the selected rendering path nor a quality level.

EnabledFeaturesProperty
# EnabledFeatures
C#
public string EnabledFeatures { get; }

Browser-reported accepted features as a comma-separated string after SessionStarted. Not a copy of RequiredFeatures/OptionalFeatures. If the browser provides no enabledFeatures property, JS reports an empty string, which does not prove all capabilities absent. Uninitialize clears it.

OptionalFeaturesProperty
# OptionalFeatures
C#
public string OptionalFeatures { get; set; }

Comma-separated optional-feature string, initially empty. Used for the next session request; the setter only stores it. Missing optional functionality must not break the baseline workflow: check EnabledFeatures after SessionStarted, not merely this request list.

ReferenceSpaceTypeProperty
# ReferenceSpaceType
C#
public string ReferenceSpaceType { get; }

Actual selected reference space after SessionStarted, not the first requested string. May be empty before readiness; Uninitialize clears it. If local was selected, do not treat Y=0 as the physical floor.

RequestedReferenceSpaceTypesProperty
# RequestedReferenceSpaceTypes
C#
public string RequestedReferenceSpaceTypes { get; set; }

Comma-separated reference-space list in attempt order, initially local. For example local-floor,local: fallback to local changes height semantics and establishes no floor. Request required features separately. An entirely empty string causes early Initialize failure; avoid empty list elements.

RequiredFeaturesProperty
# RequiredFeatures
C#
public string RequiredFeatures { get; set; }

Comma-separated required-feature string, initially empty. Before Initialize request only necessary features, for example local-floor. JS trims whitespace and removes empty entries. An unsupported required feature can reject startup; the stored string establishes no permission.

SessionModeProperty
# SessionMode
C#
public string SessionMode { get; set; }

Requested session mode: inline, immersive-vr or immersive-ar; initially inline. The setter stores a string for startup, without checking support or switching a running session. Query the intended mode separately with IsSessionSupported.

VisibilityStateProperty
# VisibilityState
C#
public string VisibilityState { get; }

Current session browser visibilityState: typically visible, visible-blurred or hidden; empty string without a session/value. XR-session visibility is neither geometry readiness nor a device HasTrackingData flag. Read again on VisibilityStateChanged.

Methods20

GetAvailableDisplayRefreshRatesReckfell.Collections.Array
# GetAvailableDisplayRefreshRates
C#
public Reckfell.Collections.Array GetAvailableDisplayRefreshRates();

Returns a fresh array container copied from browser supportedFrameRates; empty without session, property or entries. Does not measure performance or guarantee every request is accepted now. Dispose/use using for the owned Array container; it owns no XR device.

Returns Reckfell.Collections.Array

Fresh Array of rates, possibly empty. The caller owns the container.

GetDisableWebxrLayersbool
# GetDisableWebxrLayers
C#
public bool GetDisableWebxrLayers();

Returns the stored value. Stored WebXR Layers disable flag, initially false. Set before Initialize; true selects XRWebGLLayer fallback. Actual fallback can occur even at false because multiview/binding/createProjectionLayer is unavailable. The getter reports neither the selected rendering path nor a quality level.

Returns bool

Stored WebXR Layers disable flag, initially false. Set before Initialize; true selects XRWebGLLayer fallback. Actual fallback can occur even at false because multiview/binding/createProjectionLayer is unavailable. The getter reports neither the selected rendering path nor a quality level.

GetDisplayRefreshRatefloat
# GetDisplayRefreshRate
C#
public float GetDisplayRefreshRate();

Reads browser session.frameRate; 0 if session or property is absent. Neither measured application FPS nor stored target rate. The JS function declares an integer ABI; fractional values across the real WASM boundary were not tested here.

Returns float

Browser-reported rate, or 0 if unavailable; not application FPS.

GetEnabledFeaturesstring
# GetEnabledFeatures
C#
public string GetEnabledFeatures();

Reads the current value. Browser-reported accepted features as a comma-separated string after SessionStarted. Not a copy of RequiredFeatures/OptionalFeatures. If the browser provides no enabledFeatures property, JS reports an empty string, which does not prove all capabilities absent. Uninitialize clears it.

Returns string

Browser-reported accepted features as a comma-separated string after SessionStarted. Not a copy of RequiredFeatures/OptionalFeatures. If the browser provides no enabledFeatures property, JS reports an empty string, which does not prove all capabilities absent. Uninitialize clears it.

GetInputSourceTargetRayModeWebXRInterface.TargetRayMode
# GetInputSourceTargetRayMode
C#
public WebXRInterface.TargetRayMode GetInputSourceTargetRayMode(int inputSourceId);

Returns an active slot’s ray mode: Gaze, TrackedPointer or Screen. Unknown for inactive/invalid slots; an invalid index also emits a native error. Ray mode establishes neither grip, buttons nor a hand skeleton.

Parameters
NameTypeDefault
inputSourceIdint—
inputSourceId

WebXR slot ID in 0–15. A transient source, not a gamepad index or permanent device ID; check activity and tracking data.

Returns WebXRInterface.TargetRayMode

Active source’s mode or Unknown; not proof of a physical controller.

GetInputSourceTrackerXRControllerTracker
# GetInputSourceTracker
C#
public XRControllerTracker GetInputSourceTracker(int inputSourceId);

Returns the slot’s borrowed XRControllerTracker or null. Check activity and the required pose data; do not Free/Dispose the provider-owned wrapper. Slots and trackers may disappear or be reused; do not retain them as permanent device identity.

Parameters
NameTypeDefault
inputSourceIdint—
inputSourceId

WebXR slot ID in 0–15. A transient source, not a gamepad index or permanent device ID; check activity and tracking data.

Returns XRControllerTracker

Borrowed tracker or null; ownership is not transferred.

GetOptionalFeaturesstring
# GetOptionalFeatures
C#
public string GetOptionalFeatures();

Returns the stored value. Comma-separated optional-feature string, initially empty. Used for the next session request; the setter only stores it. Missing optional functionality must not break the baseline workflow: check EnabledFeatures after SessionStarted, not merely this request list.

Returns string

Comma-separated optional-feature string, initially empty. Used for the next session request; the setter only stores it. Missing optional functionality must not break the baseline workflow: check EnabledFeatures after SessionStarted, not merely this request list.

GetReferenceSpaceTypestring
# GetReferenceSpaceType
C#
public string GetReferenceSpaceType();

Reads the current value. Actual selected reference space after SessionStarted, not the first requested string. May be empty before readiness; Uninitialize clears it. If local was selected, do not treat Y=0 as the physical floor.

Returns string

Actual selected reference space after SessionStarted, not the first requested string. May be empty before readiness; Uninitialize clears it. If local was selected, do not treat Y=0 as the physical floor.

GetRequestedReferenceSpaceTypesstring
# GetRequestedReferenceSpaceTypes
C#
public string GetRequestedReferenceSpaceTypes();

Returns the stored value. Comma-separated reference-space list in attempt order, initially local. For example local-floor,local: fallback to local changes height semantics and establishes no floor. Request required features separately. An entirely empty string causes early Initialize failure; avoid empty list elements.

Returns string

Comma-separated reference-space list in attempt order, initially local. For example local-floor,local: fallback to local changes height semantics and establishes no floor. Request required features separately. An entirely empty string causes early Initialize failure; avoid empty list elements.

GetRequiredFeaturesstring
# GetRequiredFeatures
C#
public string GetRequiredFeatures();

Returns the stored value. Comma-separated required-feature string, initially empty. Before Initialize request only necessary features, for example local-floor. JS trims whitespace and removes empty entries. An unsupported required feature can reject startup; the stored string establishes no permission.

Returns string

Comma-separated required-feature string, initially empty. Before Initialize request only necessary features, for example local-floor. JS trims whitespace and removes empty entries. An unsupported required feature can reject startup; the stored string establishes no permission.

GetSessionModestring
# GetSessionMode
C#
public string GetSessionMode();

Returns the stored value. Requested session mode: inline, immersive-vr or immersive-ar; initially inline. The setter stores a string for startup, without checking support or switching a running session. Query the intended mode separately with IsSessionSupported.

Returns string

Requested session mode: inline, immersive-vr or immersive-ar; initially inline. The setter stores a string for startup, without checking support or switching a running session. Query the intended mode separately with IsSessionSupported.

GetVisibilityStatestring
# GetVisibilityState
C#
public string GetVisibilityState();

Reads the current value. Current session browser visibilityState: typically visible, visible-blurred or hidden; empty string without a session/value. XR-session visibility is neither geometry readiness nor a device HasTrackingData flag. Read again on VisibilityStateChanged.

Returns string

Current session browser visibilityState: typically visible, visible-blurred or hidden; empty string without a session/value. XR-session visibility is neither geometry readiness nor a device HasTrackingData flag. Read again on VisibilityStateChanged.

IsInputSourceActivebool
# IsInputSourceActive
C#
public bool IsInputSourceActive(int inputSourceId);

Reads activity of a WebXR input-source slot. Valid IDs are 0–15; an invalid index emits a native error and returns false. True guarantees neither a grip pose, physical controller nor every button. Not a gamepad index.

Parameters
NameTypeDefault
inputSourceIdint—
inputSourceId

WebXR slot ID in 0–15. A transient source, not a gamepad index or permanent device ID; check activity and tracking data.

Returns bool

Current slot activity; invalid index returns false with a native error.

IsSessionSupportedvoid
# IsSessionSupported
C#
public void IsSessionSupported(string sessionMode);

Asynchronously queries support for the specified mode; returns no boolean and starts no session. Subscribe to SessionSupported first and match the response sessionMode. Current JS has no rejected-promise handler: provide a pending-query timeout without treating it as confirmed false.

Parameters
NameTypeDefault
sessionModestring—
sessionMode

Mode inline, immersive-vr or immersive-ar. Support and permission are mode-specific.

SetDisableWebxrLayersvoid
# SetDisableWebxrLayers
C#
public void SetDisableWebxrLayers(bool disable);

Stores configuration without recreating a running browser session. Stored WebXR Layers disable flag, initially false. Set before Initialize; true selects XRWebGLLayer fallback. Actual fallback can occur even at false because multiview/binding/createProjectionLayer is unavailable. The getter reports neither the selected rendering path nor a quality level.

Parameters
NameTypeDefault
disablebool—
disable

Stored WebXR Layers disable flag, initially false. Set before Initialize; true selects XRWebGLLayer fallback. Actual fallback can occur even at false because multiview/binding/createProjectionLayer is unavailable. The getter reports neither the selected rendering path nor a quality level.

SetDisplayRefreshRatevoid
# SetDisplayRefreshRate
C#
public void SetDisplayRefreshRate(float refreshRate);

Asynchronously requests session.updateTargetFrameRate. Silently does nothing without a session or method. Choose a listed available rate; application is not guaranteed. A resolved promise triggers DisplayRefreshRateChanged. Current bridge has no rejection handler or dedicated request-failure event.

Parameters
NameTypeDefault
refreshRatefloat—
refreshRate

Requested device-listed frequency in Hz, not desired game FPS. Current JS parameter ABI is integer; fractional rates through WASM were not tested here.

SetOptionalFeaturesvoid
# SetOptionalFeatures
C#
public void SetOptionalFeatures(string optionalFeatures);

Stores configuration without recreating a running browser session. Comma-separated optional-feature string, initially empty. Used for the next session request; the setter only stores it. Missing optional functionality must not break the baseline workflow: check EnabledFeatures after SessionStarted, not merely this request list.

Parameters
NameTypeDefault
optionalFeaturesstring—
optionalFeatures

Comma-separated optional-feature string, initially empty. Used for the next session request; the setter only stores it. Missing optional functionality must not break the baseline workflow: check EnabledFeatures after SessionStarted, not merely this request list.

SetRequestedReferenceSpaceTypesvoid
# SetRequestedReferenceSpaceTypes
C#
public void SetRequestedReferenceSpaceTypes(string requestedReferenceSpaceTypes);

Stores configuration without recreating a running browser session. Comma-separated reference-space list in attempt order, initially local. For example local-floor,local: fallback to local changes height semantics and establishes no floor. Request required features separately. An entirely empty string causes early Initialize failure; avoid empty list elements.

Parameters
NameTypeDefault
requestedReferenceSpaceTypesstring—
requestedReferenceSpaceTypes

Comma-separated reference-space list in attempt order, initially local. For example local-floor,local: fallback to local changes height semantics and establishes no floor. Request required features separately. An entirely empty string causes early Initialize failure; avoid empty list elements.

SetRequiredFeaturesvoid
# SetRequiredFeatures
C#
public void SetRequiredFeatures(string requiredFeatures);

Stores configuration without recreating a running browser session. Comma-separated required-feature string, initially empty. Before Initialize request only necessary features, for example local-floor. JS trims whitespace and removes empty entries. An unsupported required feature can reject startup; the stored string establishes no permission.

Parameters
NameTypeDefault
requiredFeaturesstring—
requiredFeatures

Comma-separated required-feature string, initially empty. Before Initialize request only necessary features, for example local-floor. JS trims whitespace and removes empty entries. An unsupported required feature can reject startup; the stored string establishes no permission.

SetSessionModevoid
# SetSessionMode
C#
public void SetSessionMode(string sessionMode);

Stores configuration without recreating a running browser session. Requested session mode: inline, immersive-vr or immersive-ar; initially inline. The setter stores a string for startup, without checking support or switching a running session. Query the intended mode separately with IsSessionSupported.

Parameters
NameTypeDefault
sessionModestring—
sessionMode

Mode inline, immersive-vr or immersive-ar. Support and permission are mode-specific.

Signals and events13

DisplayRefreshRateChangedEvent
# DisplayRefreshRateChanged
C#
public event Action DisplayRefreshRateChanged;

Parameterless notification after a resolved updateTargetFrameRate promise. Read GetDisplayRefreshRate again; neither a frame event nor an FPS counter. Missing method means the request is ignored; a rejected promise is not converted into SessionFailed.

ReferenceSpaceResetEvent
# ReferenceSpaceReset
C#
public event Action ReferenceSpaceReset;

Parameterless reset notification from the selected reference space. Reassess gameplay-world bindings; this event does not forward the original browser transform. Do not automatically apply another recenter over the configured origin.

SelectEvent
# Select
C#
public event WebXRInterface.SelectEventHandler Select;

Completion of the source’s primary selection action, synthesized by current native code immediately after Selectend. Not a separately forwarded browser event or hold start. Choose one completion event for a one-shot gameplay operation.

Handler parameters
NameTypeDefault
inputSourceIdlong—
inputSourceId

WebXR slot ID in 0–15. A transient source, not a gamepad index or permanent device ID; check activity and tracking data.

SelectendEvent
# Selectend
C#
public event WebXRInterface.SelectendEventHandler Selectend;

End of the source’s primary selection action; current native code then separately emits Select. Do not handle both as two independent purchases/shots.

Handler parameters
NameTypeDefault
inputSourceIdlong—
inputSourceId

WebXR slot ID in 0–15. A transient source, not a gamepad index or permanent device ID; check activity and tracking data.

SelectstartEvent
# Selectstart
C#
public event WebXRInterface.SelectstartEventHandler Selectstart;

Start of the source’s primary selection action. Native code updates the input source before notification. Does not establish a trigger/grip button on every device; use the supplied ID and ray mode.

Handler parameters
NameTypeDefault
inputSourceIdlong—
inputSourceId

WebXR slot ID in 0–15. A transient source, not a gamepad index or permanent device ID; check activity and tracking data.

SessionEndedEvent
# SessionEnded
C#
public event Action SessionEnded;

Browser-end notification after native Uninitialize. Restore the previous Viewport.UseXR, ordinary UI and owned state. Do not assume every direct Uninitialize call must synchronously emit it; avoid an automatic restart loop.

SessionFailedEvent
# SessionFailed
C#
public event WebXRInterface.SessionFailedEventHandler SessionFailed;

Early-validation or asynchronous-startup failure with a reason string. Early failure can occur within Initialize; the browser-failure callback uninitializes first. Restore UI/viewport and retain message. Not a universal error event: current bridge does not handle rejected support/refresh promises.

Handler parameters
NameTypeDefault
messagestring—
message

Startup-failure reason. Retain for diagnosis and present a useful result; do not replace it with an unsupported claim that no headset exists.

SessionStartedEvent
# SessionStarted
C#
public event Action SessionStarted;

Emitted after browser-session creation, GL setup and reference-space acquisition. Read ReferenceSpaceType/EnabledFeatures and enable Viewport.UseXR afterward. Do not substitute Initialize=true: initialized is set earlier. The event establishes neither pixel quality nor controllers.

SessionSupportedEvent
# SessionSupported
C#
public event WebXRInterface.SessionSupportedEventHandler SessionSupported;

IsSessionSupported result: mode and support boolean. Neither startup permission, required-feature validation nor assurance of successful Initialize. Without navigator.xr the bridge reports false; a rejected browser promise may currently produce no event.

Handler parameters
NameTypeDefault
sessionModestring—
supportedbool—
sessionMode

Mode inline, immersive-vr or immersive-ar. Support and permission are mode-specific.

supported

Mode-support result; true establishes neither user permission nor required features for a future request.

SqueezeEvent
# Squeeze
C#
public event WebXRInterface.SqueezeEventHandler Squeeze;

Completion of the source’s squeeze action, synthesized by current native code immediately after Squeezeend. Not a separately forwarded browser event or hold start. Choose one completion event for a one-shot gameplay operation.

Handler parameters
NameTypeDefault
inputSourceIdlong—
inputSourceId

WebXR slot ID in 0–15. A transient source, not a gamepad index or permanent device ID; check activity and tracking data.

SqueezeendEvent
# Squeezeend
C#
public event WebXRInterface.SqueezeendEventHandler Squeezeend;

End of the source’s squeeze action; current native code then separately emits Squeeze. Do not handle both as two independent purchases/shots.

Handler parameters
NameTypeDefault
inputSourceIdlong—
inputSourceId

WebXR slot ID in 0–15. A transient source, not a gamepad index or permanent device ID; check activity and tracking data.

SqueezestartEvent
# Squeezestart
C#
public event WebXRInterface.SqueezestartEventHandler Squeezestart;

Start of the source’s squeeze action. Native code updates the input source before notification. Does not establish a trigger/grip button on every device; use the supplied ID and ray mode.

Handler parameters
NameTypeDefault
inputSourceIdlong—
inputSourceId

WebXR slot ID in 0–15. A transient source, not a gamepad index or permanent device ID; check activity and tracking data.

VisibilityStateChangedEvent
# VisibilityStateChanged
C#
public event Action VisibilityStateChanged;

Parameterless browser visibilitychange notification. Read VisibilityState and apply your game’s pause/UI policy. Does not mean session end, model availability or restored tracking.

WebXRInterface.TargetRayMode

ValueDescription
Gaze = 1

Target ray originates at the viewer's eyes and points in the direction they are looking.

Screen = 3

Target ray from touch screen, mouse or other tactile input device.

TrackedPointer = 2

Target ray from a handheld pointer, most likely a VR touch controller.

Unknown = 0

We don't know the target ray mode.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.