Class SpatialRaycastFeature
Enables AR Foundation ray cast support via OpenXR Spatial Entities extensions.
Inheritance
Implements
Inherited Members
Namespace: UnityEngine.XR.OpenXR.Features.SpatialEntities
Assembly: Unity.XR.SpatialEntities.dll
Syntax
public class SpatialRaycastFeature : SpatialSetupConfigurationProvider, IConfigurationAnalytic
Fields
featureId
The feature id string. This is used to give the feature a well known id for reference.
Declaration
public const string featureId = "com.unity.openxr.feature.arfoundation-spatialentities-raycast"
Field Value
| Type | Description |
|---|---|
| string |
Properties
enableDepthRaycast
Get or set whether the ray cast provider configures the depth ray cast capability, which lets you cast rays against the runtime's environment depth map. You can only set this value before you initialize the OpenXR loader.
Declaration
public bool enableDepthRaycast { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Enabling this changes the scene understanding permission your app requires. Refer to Permissions for more information.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if you set this value after you have initialized the OpenXR loader. |
Methods
GetValidationChecks(List<ValidationRule>, BuildTargetGroup)
Get validation rules for this feature.
Declaration
protected override void GetValidationChecks(List<OpenXRFeature.ValidationRule> rules, BuildTargetGroup targetGroup)
Parameters
| Type | Name | Description |
|---|---|---|
| List<OpenXRFeature.ValidationRule> | rules | |
| BuildTargetGroup | targetGroup |
Overrides
Remarks
Adds a validation rule for each installed ray cast provider that conflicts with this feature.
Only one ray cast provider can be enabled at a time. If two are enabled, each creates an
UnityEngine.XR.ARSubsystems.XRRaycastSubsystem, and which instance ARRaycastManager receives is undefined.
OnInstanceCreate(ulong)
Called after xrCreateInstance. Override this method to validate that any necessary OpenXR extensions were
successfully enabled
(OpenXRRuntime.IsExtensionEnabled)
and that any required system properties are supported. If this method returns false,
the feature's enabled property is set to false.
Declaration
protected override bool OnInstanceCreate(ulong xrInstance)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrInstance | Handle of the native |
Returns
| Type | Description |
|---|---|
| bool | true if this feature successfully initialized. Otherwise, false. |
Overrides
Remarks
If this feature is a required feature of an enabled feature set, returning false here
causes the OpenXRLoader to fail, and XR Plug-in Management will fall back to another loader if enabled.
See Also
OnInstanceDestroy(ulong)
Called before the OpenXR instance is destroyed.
Declaration
protected override void OnInstanceDestroy(ulong xrInstance)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrInstance | The OpenXR instance handle. |
Overrides
OnSubsystemCreate()
Called after the OpenXR Loader is initialized and has created its subsystems.
Declaration
protected override void OnSubsystemCreate()
Overrides
OnSubsystemDestroy()
Called before the OpenXR Loader destroys its subsystems.
Declaration
protected override void OnSubsystemDestroy()