XRSpatialContainerFeature

This feature provides access to the XR_EXT_spatial_container_self_rendering extension.

This feature allows the application content to be rendered within a single spatial container.

Summary

Inheritance

Inherits from: OpenXRFeature

Public attributes

ExtensionStrings = "XR_EXT_spatial_container XR_EXT_spatial_container_self_rendering"
const string
The required OpenXR extension.
FeatureId = "com.google.xr.extensions.spatial_container"
const string
The feature ID string.
SuggestedBounds => _suggestedBounds
Vector3
Gets the suggested bounds.
UiName = "Spatial Container"
const string
The UI name shows on the XR Plug-in Management panel, help users to understand validation errors and expected fixes.

Public static attributes

IsExtensionEnabled => _extensionEnabled
bool
Gets if the required OpenXR extension is enabled.
RequiredPermission = AndroidXRPermission.SceneUnderstandingCoarse
Runtime permission required to enable scene understanding coarse.

Events

OnSpatialContainerBoundsChanged
static Action< Vector3, bool >
Invoked when the spatial container bounds have changed.
OnSpatialContainerBoundsModeRequestDenied
static Action
Invoked when a spatial container bounds mode request is denied.
OnSpatialContainerClosed
static Action
Invoked when the spatial container is closed.
OnSpatialContainerStateChanged
static Action< XRSpatialContainerStateFlags, bool >
Invoked when a spatial container state has changed.
OnSpatialContainerVisibilityRequestDenied
static Action
Invoked when a spatial container visibility request is denied.

Public static functions

TryGetBounds(out Vector3 outBounds)
bool
Tries to get the bounds of the spatial container.
TryGetState(out XRSpatialContainerStateFlags outState)
bool
Tries to get the state of the spatial container.
TryRequestBoundsMode(bool immersive)
bool
Tries to request the bounds mode of the spatial container.
TryRequestVisibility(bool visible)
bool
Tries to request the visibility of the spatial container.

Public attributes

ExtensionStrings

const string ExtensionStrings =
            "XR_EXT_spatial_container XR_EXT_spatial_container_self_rendering"

The required OpenXR extension.

FeatureId

const string FeatureId = "com.google.xr.extensions.spatial_container"

The feature ID string.

SuggestedBounds

Vector3 SuggestedBounds => _suggestedBounds

Gets the suggested bounds.

UiName

const string UiName = "Spatial Container"

The UI name shows on the XR Plug-in Management panel, help users to understand validation errors and expected fixes.

Public static attributes

IsExtensionEnabled

bool IsExtensionEnabled => _extensionEnabled

Gets if the required OpenXR extension is enabled.

When OpenXR runtime is waiting, it returns null. Otherwise, it indicates whether the XR_EXT_spatial_container_self_rendering extension is available and supported on current device.

RequiredPermission

readonly AndroidXRPermission RequiredPermission =
            AndroidXRPermission.SceneUnderstandingCoarse

Runtime permission required to enable scene understanding coarse.

Events

OnSpatialContainerBoundsChanged

static Action< Vector3, bool > OnSpatialContainerBoundsChanged

Invoked when the spatial container bounds have changed.

OnSpatialContainerBoundsModeRequestDenied

static Action OnSpatialContainerBoundsModeRequestDenied

Invoked when a spatial container bounds mode request is denied.

OnSpatialContainerClosed

static Action OnSpatialContainerClosed

Invoked when the spatial container is closed.

OnSpatialContainerStateChanged

static Action< XRSpatialContainerStateFlags, bool > OnSpatialContainerStateChanged

Invoked when a spatial container state has changed.

OnSpatialContainerVisibilityRequestDenied

static Action OnSpatialContainerVisibilityRequestDenied

Invoked when a spatial container visibility request is denied.

Public static functions

TryGetBounds

bool TryGetBounds(
  out Vector3 outBounds
)

Tries to get the bounds of the spatial container.

Details
Parameters
outBounds
The dimensions of the spatial container bounding box.
Returns
True if the bounds were retrieved successfully, false otherwise.

TryGetState

bool TryGetState(
  out XRSpatialContainerStateFlags outState
)

Tries to get the state of the spatial container.

Details
Parameters
outState
The state of the spatial container.
Returns
True if the state was retrieved successfully, false otherwise.

TryRequestBoundsMode

bool TryRequestBoundsMode(
  bool immersive
)

Tries to request the bounds mode of the spatial container.

By default, the spatial container starts in bounded mode.

Details
Parameters
immersive
Whether to request immersive bounds mode. If false, requests bounded mode.
Returns
True if the bounds mode was requested successfully, false otherwise.

TryRequestVisibility

bool TryRequestVisibility(
  bool visible
)

Tries to request the visibility of the spatial container.

By default, the spatial container starts in visible mode.

Details
Parameters
visible
Whether to request the container to be visible.
Returns
True if the visibility was requested successfully, false otherwise.