docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class MockRuntime

    Inheritance
    object
    Object
    ScriptableObject
    OpenXRFeature
    MockRuntime
    Inherited Members
    OpenXRFeature.enabled
    OpenXRFeature.xrGetInstanceProcAddr
    OpenXRFeature.OnEnabledChange()
    OpenXRFeature.PathToString(ulong)
    OpenXRFeature.StringToPath(string)
    OpenXRFeature.GetCurrentInteractionProfile(ulong)
    OpenXRFeature.GetCurrentInteractionProfile(string)
    OpenXRFeature.GetCurrentAppSpace()
    OpenXRFeature.GetViewConfigurationTypeForRenderPass(int)
    OpenXRFeature.SetEnvironmentBlendMode(XrEnvironmentBlendMode)
    OpenXRFeature.GetEnvironmentBlendMode()
    OpenXRFeature.CreateSubsystem<TDescriptor, TSubsystem>(List<TDescriptor>, string)
    OpenXRFeature.StartSubsystem<T>()
    OpenXRFeature.StopSubsystem<T>()
    OpenXRFeature.DestroySubsystem<T>()
    OpenXRFeature.OnEnable()
    OpenXRFeature.OnDisable()
    OpenXRFeature.Awake()
    OpenXRFeature.GetAction(InputAction)
    OpenXRFeature.GetAction(InputDevice, InputFeatureUsage)
    OpenXRFeature.GetAction(InputDevice, string)
    OpenXRFeature.RegisterStatsDescriptor(string, OpenXRFeature.StatFlags)
    OpenXRFeature.SetStatAsFloat(ulong, float)
    OpenXRFeature.SetStatAsUInt(ulong, uint)
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(string)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.OpenXR.Features.Mock
    Assembly: Unity.XR.OpenXR.Features.MockRuntime.dll
    Syntax
    public class MockRuntime : OpenXRFeature

    Fields

    TestCallback

    Declaration
    [NonSerialized]
    public Func<string, object, object> TestCallback
    Field Value
    Type Description
    Func<string, object, object>

    XR_UNITY_android_present

    Declaration
    public const string XR_UNITY_android_present = "XR_UNITY_android_present"
    Field Value
    Type Description
    string

    XR_UNITY_mock_test

    Declaration
    public const string XR_UNITY_mock_test = "XR_UNITY_mock_test"
    Field Value
    Type Description
    string

    XR_UNITY_null_gfx

    Declaration
    public const string XR_UNITY_null_gfx = "XR_UNITY_null_gfx"
    Field Value
    Type Description
    string

    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.mockruntime"
    Field Value
    Type Description
    string

    ignoreValidationErrors

    Don't fail to build if there are validation errors.

    Declaration
    public bool ignoreValidationErrors
    Field Value
    Type Description
    bool

    Properties

    Instance

    Return the singleton instance of the Mock Runtime feature.

    Declaration
    public static MockRuntime Instance { get; }
    Property Value
    Type Description
    MockRuntime

    XrInstance

    Declaration
    public ulong XrInstance { get; }
    Property Value
    Type Description
    ulong

    XrSession

    Declaration
    public ulong XrSession { get; }
    Property Value
    Type Description
    ulong

    sessionState

    Return the current session state of the MockRuntime

    Declaration
    public static XrSessionState sessionState { get; }
    Property Value
    Type Description
    XrSessionState

    Methods

    CauseInstanceLoss()

    Force MockRuntime instance loss.

    Declaration
    public static extern void CauseInstanceLoss()

    CauseUserPresenceChange(bool)

    Force user presence change.

    Declaration
    public static extern void CauseUserPresenceChange(bool hasUserPresent)
    Parameters
    Type Name Description
    bool hasUserPresent

    User present when true.

    ChooseEnvironmentBlendMode(XrEnvironmentBlendMode)

    Declaration
    public static void ChooseEnvironmentBlendMode(XrEnvironmentBlendMode mode)
    Parameters
    Type Name Description
    XrEnvironmentBlendMode mode

    ClearFunctionCallbacks()

    Remove all OpenXR function callbacks

    Declaration
    public static void ClearFunctionCallbacks()

    GetAfterFunctionCallback(string)

    Return the callback set to be called after the given OpenXR function is called

    Declaration
    public static MockRuntime.AfterFunctionDelegate GetAfterFunctionCallback(string function)
    Parameters
    Type Name Description
    string function

    OpenXR function name

    Returns
    Type Description
    MockRuntime.AfterFunctionDelegate

    Callback or null if no callback is set

    GetBeforeFunctionCallback(string)

    Return the callback set to be called before the given OpenXR function is called

    Declaration
    public static MockRuntime.BeforeFunctionDelegate GetBeforeFunctionCallback(string function)
    Parameters
    Type Name Description
    string function

    OpenXR function name

    Returns
    Type Description
    MockRuntime.BeforeFunctionDelegate

    Callback or null if no callback is set

    GetValidationChecks(List<ValidationRule>, BuildTargetGroup)

    Allows a feature to add to a list of validation rules which your feature will evaluate at build time. Details of the validation results can be found in OpenXRProjectValidation.

    Declaration
    protected override void GetValidationChecks(List<OpenXRFeature.ValidationRule> results, BuildTargetGroup target)
    Parameters
    Type Name Description
    List<OpenXRFeature.ValidationRule> results
    BuildTargetGroup target
    Overrides
    OpenXRFeature.GetValidationChecks(List<OpenXRFeature.ValidationRule>, BuildTargetGroup)

    GetXrEnvironmentBlendMode()

    Declaration
    public static XrEnvironmentBlendMode GetXrEnvironmentBlendMode()
    Returns
    Type Description
    XrEnvironmentBlendMode

    HookCreateInstance(IntPtr)

    Called to hook xrGetInstanceProcAddr.

    Declaration
    public static extern IntPtr HookCreateInstance(IntPtr func)
    Parameters
    Type Name Description
    IntPtr func

    xrGetInstanceProcAddr native function pointer

    Returns
    Type Description
    IntPtr

    Function pointer that Unity will use to look up XR native functions.

    HookGetInstanceProcAddr(IntPtr)

    Called to hook xrGetInstanceProcAddr. Returning a different function pointer allows intercepting any OpenXR method.

    Declaration
    protected override IntPtr HookGetInstanceProcAddr(IntPtr func)
    Parameters
    Type Name Description
    IntPtr func

    xrGetInstanceProcAddr native function pointer

    Returns
    Type Description
    IntPtr

    Function pointer that Unity will use to look up OpenXR native functions.

    Overrides
    OpenXRFeature.HookGetInstanceProcAddr(IntPtr)

    OnAppSpaceChange(ulong)

    Called when the reference xrSpace for the app changes.

    Declaration
    protected override void OnAppSpaceChange(ulong xrSpace)
    Parameters
    Type Name Description
    ulong xrSpace

    Handle of the xrSpace

    Overrides
    OpenXRFeature.OnAppSpaceChange(ulong)

    OnEnvironmentBlendModeChange(XrEnvironmentBlendMode)

    Notification to the feature implementer that the environment blend mode has changed.

    Declaration
    protected override void OnEnvironmentBlendModeChange(XrEnvironmentBlendMode xrEnvironmentBlendMode)
    Parameters
    Type Name Description
    XrEnvironmentBlendMode xrEnvironmentBlendMode

    New environment blend mode value

    Overrides
    OpenXRFeature.OnEnvironmentBlendModeChange(XrEnvironmentBlendMode)

    OnFormFactorChange(int)

    Notification to the feature implementer that the form factor has changed.

    Declaration
    protected override void OnFormFactorChange(int xrFormFactor)
    Parameters
    Type Name Description
    int xrFormFactor

    New form factor value

    Overrides
    OpenXRFeature.OnFormFactorChange(int)

    OnInstanceCreate(ulong)

    Called after xrCreateInstance.

    Declaration
    protected override bool OnInstanceCreate(ulong xrInstance)
    Parameters
    Type Name Description
    ulong xrInstance

    Handle of the xrInstance

    Returns
    Type Description
    bool

    Always returns true, as this is intended to be overridden.

    Overrides
    OpenXRFeature.OnInstanceCreate(ulong)

    OnInstanceDestroy(ulong)

    Called before xrDestroyInstance

    Declaration
    protected override void OnInstanceDestroy(ulong instance)
    Parameters
    Type Name Description
    ulong instance
    Overrides
    OpenXRFeature.OnInstanceDestroy(ulong)

    OnInstanceLossPending(ulong)

    Called when the OpenXR loader receives the XR_TYPE_EVENT_DATA_INSTANCE_LOSS_PENDING event from the runtime. This is a notification to the feature implementer that the instance is about to be lost. This feature should do what it needs to do to clean up in preparation for termination.

    Declaration
    protected override void OnInstanceLossPending(ulong xrInstance)
    Parameters
    Type Name Description
    ulong xrInstance

    The instance that is going to be lost

    Overrides
    OpenXRFeature.OnInstanceLossPending(ulong)

    OnSessionBegin(ulong)

    Called after xrSessionBegin.

    Declaration
    protected override void OnSessionBegin(ulong xrSession)
    Parameters
    Type Name Description
    ulong xrSession

    Handle of the xrSession

    Overrides
    OpenXRFeature.OnSessionBegin(ulong)

    OnSessionCreate(ulong)

    Called after xrCreateSession.

    Declaration
    protected override void OnSessionCreate(ulong xrSession)
    Parameters
    Type Name Description
    ulong xrSession

    Handle of the xrSession

    Overrides
    OpenXRFeature.OnSessionCreate(ulong)

    OnSessionDestroy(ulong)

    Called before xrDestroySession.

    Declaration
    protected override void OnSessionDestroy(ulong session)
    Parameters
    Type Name Description
    ulong session
    Overrides
    OpenXRFeature.OnSessionDestroy(ulong)

    OnSessionEnd(ulong)

    Called before xrEndSession.

    Declaration
    protected override void OnSessionEnd(ulong xrSession)
    Parameters
    Type Name Description
    ulong xrSession

    Handle of the xrSession

    Overrides
    OpenXRFeature.OnSessionEnd(ulong)

    OnSessionExiting(ulong)

    Called when the runtime transitions to the XR_SESSION_STATE_EXITING state.

    Declaration
    protected override void OnSessionExiting(ulong xrSession)
    Parameters
    Type Name Description
    ulong xrSession

    Handle of the xrSession

    Overrides
    OpenXRFeature.OnSessionExiting(ulong)

    OnSessionLossPending(ulong)

    Called when the runtime transitions to the XR_SESSION_STATE_LOSS_PENDING state. This is a notification to the feature implementer that the session is about to be lost. This feature should do what it needs to do to prepare for potential session recreation.

    Declaration
    protected override void OnSessionLossPending(ulong xrSession)
    Parameters
    Type Name Description
    ulong xrSession

    The session that is going to be lost

    Overrides
    OpenXRFeature.OnSessionLossPending(ulong)

    OnSessionStateChange(int, int)

    Called when the OpenXR loader receives the XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED event from the runtime signaling that the XrSessionState has changed.

    Declaration
    protected override void OnSessionStateChange(int oldState, int newState)
    Parameters
    Type Name Description
    int oldState

    Previous state

    int newState

    New state

    Overrides
    OpenXRFeature.OnSessionStateChange(int, int)

    OnSubsystemCreate()

    Called after the OpenXR Loader is initialized and has created its subsystems.

    Declaration
    protected override void OnSubsystemCreate()
    Overrides
    OpenXRFeature.OnSubsystemCreate()

    OnSubsystemDestroy()

    Called before the OpenXR loader destroys its subsystems.

    Declaration
    protected override void OnSubsystemDestroy()
    Overrides
    OpenXRFeature.OnSubsystemDestroy()

    OnSubsystemStart()

    Called after the OpenXR loader has started its subsystems.

    Declaration
    protected override void OnSubsystemStart()
    Overrides
    OpenXRFeature.OnSubsystemStart()

    OnSubsystemStop()

    Called before the OpenXR loader stops its subsystems.

    Declaration
    protected override void OnSubsystemStop()
    Overrides
    OpenXRFeature.OnSubsystemStop()

    OnSystemChange(ulong)

    Called after xrGetSystem.

    Declaration
    protected override void OnSystemChange(ulong xrSystem)
    Parameters
    Type Name Description
    ulong xrSystem

    Handle of the xrSystemId

    Overrides
    OpenXRFeature.OnSystemChange(ulong)

    OnViewConfigurationTypeChange(int)

    Notification to the feature implementer that the view configuration type has changed.

    Declaration
    protected override void OnViewConfigurationTypeChange(int xrViewConfigurationType)
    Parameters
    Type Name Description
    int xrViewConfigurationType

    New view configuration type

    Overrides
    OpenXRFeature.OnViewConfigurationTypeChange(int)

    RequestExitSession()

    Request to exit the runtime session.

    Declaration
    public static extern void RequestExitSession()

    ResetDefaults()

    Reset the MockRuntime testing settings back to defaults

    Declaration
    public static void ResetDefaults()

    SetFunctionCallback(string, AfterFunctionDelegate)

    Set a callback to call before the given OpenXR function is called within the Mock Runtime

    Declaration
    public static void SetFunctionCallback(string function, MockRuntime.AfterFunctionDelegate afterCallback)
    Parameters
    Type Name Description
    string function

    OpenXR function name

    MockRuntime.AfterFunctionDelegate afterCallback

    Callback to call after the OpenXR function is called (null to clear)

    SetFunctionCallback(string, BeforeFunctionDelegate)

    Set a callback to call before the given OpenXR function is called within the Mock Runtime

    Note that since some OpenXR functions are called from within the graphics thread that care should be taken to maintain thread safety from within the callbacks.

    Note that function callbacks can be set prior to the MockRuntime being initialized but will be reset when the mock runtime is shutdown.

    Declaration
    public static void SetFunctionCallback(string function, MockRuntime.BeforeFunctionDelegate beforeCallback)
    Parameters
    Type Name Description
    string function

    OpenXR function name

    MockRuntime.BeforeFunctionDelegate beforeCallback

    Callback to call before the OpenXR function is called (null to clear)

    SetFunctionCallback(string, BeforeFunctionDelegate, AfterFunctionDelegate)

    Set the callbacks to call before and after the given OpenXR function is called within the Mock Runtime

    Note that since some OpenXR functions are called from within the graphics thread that care should be taken to maintain thread safety from within the callbacks.

    Note that function callbacks can be set prior to the MockRuntime being initialized but will be reset when the mock runtime is shutdown.

    Declaration
    public static void SetFunctionCallback(string function, MockRuntime.BeforeFunctionDelegate beforeCallback, MockRuntime.AfterFunctionDelegate afterCallback)
    Parameters
    Type Name Description
    string function

    OpenXR function name

    MockRuntime.BeforeFunctionDelegate beforeCallback

    Callback to call before the OpenXR function is called (null to clear)

    MockRuntime.AfterFunctionDelegate afterCallback

    Callback to call after the OpenXR function is called (null to clear)

    SetKeepFunctionCallbacks(bool)

    Keep function callbacks when resetting MockRuntime.

    Declaration
    public static extern void SetKeepFunctionCallbacks(bool value)
    Parameters
    Type Name Description
    bool value

    True to keep callbacks.

    SetSpace(ulong, Vector3, Quaternion, XrSpaceLocationFlags)

    Set the reference space to use for input actions.

    Declaration
    public static extern void SetSpace(ulong actionHandle, Vector3 position, Quaternion orientation, XrSpaceLocationFlags locationFlags)
    Parameters
    Type Name Description
    ulong actionHandle

    Handle to the input action.

    Vector3 position

    Position of the space.

    Quaternion orientation

    Orientation of the space.

    XrSpaceLocationFlags locationFlags

    XrSpaceLocationFlags for the space.

    SetSpace(XrReferenceSpaceType, Vector3, Quaternion, XrSpaceLocationFlags)

    Set the reference space to use at Runtime.

    Declaration
    public static extern void SetSpace(XrReferenceSpaceType referenceSpace, Vector3 position, Quaternion orientation, XrSpaceLocationFlags locationFlags)
    Parameters
    Type Name Description
    XrReferenceSpaceType referenceSpace

    The type of reference space being set.

    Vector3 position

    Position of the space.

    Quaternion orientation

    Orientation of the space.

    XrSpaceLocationFlags locationFlags

    XrSpaceLocationFlags for the space.

    SetViewPose(XrViewConfigurationType, int, Vector3, Quaternion, Vector4)

    Set the runtime ViewPose.

    Declaration
    public static extern void SetViewPose(XrViewConfigurationType viewConfigurationType, int viewIndex, Vector3 position, Quaternion orientation, Vector4 fov)
    Parameters
    Type Name Description
    XrViewConfigurationType viewConfigurationType

    The XrViewConfigurationType to use.

    int viewIndex

    The indexed view being set.

    Vector3 position

    Position of the view.

    Quaternion orientation

    Orientation of the view.

    Vector4 fov

    Field of View.

    SetViewState(XrViewConfigurationType, XrViewStateFlags)

    Set the runtime ViewState.

    Declaration
    public static extern void SetViewState(XrViewConfigurationType viewConfigurationType, XrViewStateFlags viewStateFlags)
    Parameters
    Type Name Description
    XrViewConfigurationType viewConfigurationType

    The XrViewConfigurationType to use.

    XrViewStateFlags viewStateFlags

    The XrViewStateFlags to set.

    TransitionToState(XrSessionState, bool)

    Declaration
    public static bool TransitionToState(XrSessionState state, bool forceTransition)
    Parameters
    Type Name Description
    XrSessionState state
    bool forceTransition
    Returns
    Type Description
    bool

    Events

    onScriptEvent

    Subscribe delegates to ScriptEvents.

    Declaration
    public static event MockRuntime.ScriptEventDelegate onScriptEvent
    Event Type
    Type Description
    MockRuntime.ScriptEventDelegate
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)