docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class PollEventRouter

    Manages subscriptions to events received from xrPollEvent.

    The OpenXR Plug-in calls xrPollEvent every frame during UnityEngine.Application.onBeforeRender.

    Inheritance
    object
    PollEventRouter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.XR.OpenXR.NativeTypes
    Assembly: Unity.XR.OpenXR.dll
    Syntax
    public static class PollEventRouter

    Methods

    TrySubscribeToAllEvents(XrPollEventCallback)

    Subscribe to all events. callback will be invoked whenever any event is received by xrPollEvent.

    Declaration
    public static bool TrySubscribeToAllEvents(XrPollEventCallback callback)
    Parameters
    Type Name Description
    XrPollEventCallback callback

    The delegate to invoke when any event is received.

    Returns
    Type Description
    bool

    true if the subscription attempt succeeded. false if callback was already subscribed.

    Remarks
    Important

    The pointer argument passed by callback is only valid in the scope of the callback. If you require longer-term access to event data, cast the pointer to the corresponding struct pointer type and dereference it to make a copy of the struct. Don't save the pointer itself.

    Note

    Your callback is automatically unsubscribed whenever the OpenXR loader is deinitialized.

    TrySubscribeToEventType(XrStructureType, XrPollEventCallback)

    Subscribe to a specific event type. callback will be invoked whenever the given event type is received by xrPollEvent.

    Declaration
    public static bool TrySubscribeToEventType(XrStructureType eventType, XrPollEventCallback callback)
    Parameters
    Type Name Description
    XrStructureType eventType

    The event type.

    XrPollEventCallback callback

    The delegate to invoke when an event of type eventType is received.

    Returns
    Type Description
    bool

    true if the subscription attempt succeeded. false if callback was already subscribed.

    Remarks
    Important

    The pointer argument passed by callback is only valid in the scope of the callback. If you require longer-term access to event data, cast the pointer to the corresponding struct pointer type and dereference it to make a copy of the struct. Don't save the pointer itself.

    Note

    Your callback is automatically unsubscribed whenever the OpenXR loader is deinitialized.

    TryUnsubscribeFromAllEvents(XrPollEventCallback)

    Unsubscribe from all events.

    Declaration
    public static bool TryUnsubscribeFromAllEvents(XrPollEventCallback callback)
    Parameters
    Type Name Description
    XrPollEventCallback callback

    The delegate to unsubscribe.

    Returns
    Type Description
    bool

    true if callback was unsubscribed. false if callback wasn't subscribed in the first place.

    Remarks
    Note

    All callbacks are automatically unsubscribed whenever the OpenXR loader is deinitialized.

    TryUnsubscribeFromEventType(XrStructureType, XrPollEventCallback)

    Unsubscribe from a specific event type.

    Declaration
    public static bool TryUnsubscribeFromEventType(XrStructureType eventType, XrPollEventCallback callback)
    Parameters
    Type Name Description
    XrStructureType eventType

    The event type.

    XrPollEventCallback callback

    The delegate to unsubscribe.

    Returns
    Type Description
    bool

    true if callback was unsubscribed. false if callback wasn't subscribed in the first place.

    Remarks
    Note

    All callbacks are automatically unsubscribed whenever the OpenXR loader is deinitialized.

    In This Article
    Back to top
    Copyright © 2025 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)