Class VisionOS
Runtime scripting API for VisionOS.
Inherited Members
Namespace: UnityEngine .XR.VisionOS
Assembly: Unity.XR.VisionOS.dll
Syntax
public static class VisionOS
Methods
GetLayerRenderer()
Get the native pointer to the LayerRenderer
currently being used for rendering, or IntPtr.Zero (null) if none exists. A LayerRenderer
is provided by the system for communicating with the XR compositor.
Declaration
public static IntPtr GetLayerRenderer()
Returns
Type | Description |
---|---|
Int |
The |
Remarks
Note that the layer renderer is not immediately available on app start, or immediately after enabling Metal rendering. You may need to check if this is null for a few frames before a valid pointer is available. This API always returns IntPtr.Zero (null) in the Editor.
IsImmersiveSpaceReady()
Determine whether the immersive space for the app is ready. Return true in the Editor for testing purposes.
Declaration
public static bool IsImmersiveSpaceReady()
Returns
Type | Description |
---|---|
bool | true if the immersive space is ready (or in the Editor when targeting visionOS). Otherwise, false. |
IsSimulator()
Determine whether the app is running in the visionOS simulator. Treat the Editor targeting visionOS as running in simulator.
Declaration
public static bool IsSimulator()
Returns
QueryAuthorizationStatus(VisionOSAuthorizationType)
Query the current authorization status for a given authorization type.
Declaration
public static VisionOSAuthorizationStatus QueryAuthorizationStatus(VisionOSAuthorizationType type)
Parameters
Type | Name | Description |
---|---|---|
Vision |
type | The authorization type to query. |
Returns
Type | Description |
---|---|
Vision |
The status of the queried authorization type. |
SetDepthRange(float, float)
Set the range of values used for depth sorting. These values should match Camera.nearClipPlane and Camera.farClipPlane
Declaration
public static void SetDepthRange(float near, float far)
Parameters
Type | Name | Description |
---|---|---|
float | near | The value for the near clipping plane. |
float | far | The value for the far clipping plane. |
SetMinimumFrameRepeatCount(IntPtr, int)
Set the minimum number of additional times the system displays each frame. See Apple's documentation for cp_layer_renderer_set_minimum_frame_repeat_count for more details.
Declaration
public static void SetMinimumFrameRepeatCount(IntPtr layerRenderer, int repeatCount)
Parameters
Type | Name | Description |
---|---|---|
Int |
layerRenderer | The layer renderer that is currently in use Get |
int | repeatCount | The desired repeat count. |
Remarks
If your takes longer than 11ms to render a frame (assuming a target of 90hz), the compositor will repeat the last available frame. If you know you
will not be able to consistently render at 90hz, you should use this API, along with target
Exceptions
Type | Condition |
---|---|
Argument |
Thrown when |
Argument |
Thrown when |
Events
AuthorizationChanged
Called when an ARKit authorization like hand tracking or world tracking changes status. Some examples of when this occurs:
- On app start when initially querying the authorization status, if it was already requested
- After querying authorization status, if it was not requested and the user allowed or declined
- When the user changes authorizations in Settings and returns to the app
Declaration
public static event Action<VisionOSAuthorizationEventArgs> AuthorizationChanged
Event Type
Type | Description |
---|---|
Action<Vision |