# 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 ||
|---|---|
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#extensionstrings = "XR_EXT_spatial_container XR_EXT_spatial_container_self_rendering"` | `const string` The required OpenXR extension. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#featureid = "com.google.xr.extensions.spatial_container"` | `const string` The feature ID string. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#suggestedbounds => _suggestedBounds` | `Vector3` Gets the suggested bounds. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#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 ||
|---|---|
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#isextensionenabled => _extensionEnabled` | `bool` Gets if the required OpenXR extension is enabled. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#requiredpermission = AndroidXRPermission.SceneUnderstandingCoarse` | `readonly https://developer.android.com/develop/xr/unity/reference/namespace/Google/XR/Extensions#androidxrpermission` Runtime permission required to enable scene understanding coarse. |

| ### Events ||
|---|---|
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#onspatialcontainerboundschanged` | `static Action< Vector3, bool >` Invoked when the spatial container bounds have changed. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#onspatialcontainerboundsmoderequestdenied` | `static Action` Invoked when a spatial container bounds mode request is denied. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#onspatialcontainerclosed` | `static Action` Invoked when the spatial container is closed. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#onspatialcontainerstatechanged` | `static Action< https://developer.android.com/develop/xr/unity/reference/namespace/Google/XR/Extensions#xrspatialcontainerstateflags, bool >` Invoked when a spatial container state has changed. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#onspatialcontainervisibilityrequestdenied` | `static Action` Invoked when a spatial container visibility request is denied. |

| ### Public static functions ||
|---|---|
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#trygetbounds(out Vector3 outBounds)` | `bool` Tries to get the bounds of the spatial container. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#trygetstate(out https://developer.android.com/develop/xr/unity/reference/namespace/Google/XR/Extensions#xrspatialcontainerstateflags outState)` | `bool` Tries to get the state of the spatial container. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#tryrequestboundsmode(bool immersive)` | `bool` Tries to request the bounds mode of the spatial container. |
| `https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/XRSpatialContainerFeature#tryrequestvisibility(bool visible)` | `bool` Tries to request the visibility of the spatial container. |

## Public attributes

### ExtensionStrings

```c#
const string ExtensionStrings =
            "XR_EXT_spatial_container XR_EXT_spatial_container_self_rendering"
```
The required OpenXR extension.

### FeatureId

```c#
const string FeatureId = "com.google.xr.extensions.spatial_container"
```
The feature ID string.

### SuggestedBounds

```c#
Vector3 SuggestedBounds => _suggestedBounds
```
Gets the suggested bounds.

### UiName

```c#
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

```c#
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

```c#
readonly AndroidXRPermission RequiredPermission =
            AndroidXRPermission.SceneUnderstandingCoarse
```
Runtime permission required to enable scene understanding coarse.

## Events

### OnSpatialContainerBoundsChanged

```c#
static Action< Vector3, bool > OnSpatialContainerBoundsChanged
```
Invoked when the spatial container bounds have changed.

### OnSpatialContainerBoundsModeRequestDenied

```c#
static Action OnSpatialContainerBoundsModeRequestDenied
```
Invoked when a spatial container bounds mode request is denied.

### OnSpatialContainerClosed

```c#
static Action OnSpatialContainerClosed
```
Invoked when the spatial container is closed.

### OnSpatialContainerStateChanged

```c#
static Action< XRSpatialContainerStateFlags, bool > OnSpatialContainerStateChanged
```
Invoked when a spatial container state has changed.

### OnSpatialContainerVisibilityRequestDenied

```c#
static Action OnSpatialContainerVisibilityRequestDenied
```
Invoked when a spatial container visibility request is denied.

## Public static functions

### TryGetBounds

```c#
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

```c#
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

```c#
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

```c#
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.