Class PollEventRouter
Manages subscriptions to events received from xrPollEvent.
The OpenXR Plug-in calls xrPollEvent
every frame during UnityEngine.Application.onBeforeRender.
Inherited Members
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 |
|
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 |
Returns
Type | Description |
---|---|
bool |
|
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 |
|
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 |
|
Remarks
Note
All callbacks are automatically unsubscribed whenever the OpenXR loader is deinitialized.