ProtecteddelayedProtecteddelayedProtectedlateProtectedlateProtectedmainProtectedmainProtectedpriorityProtectedupdateProtectedupdateCreates a delayed event that will be called after a specified time. Events are removed from the dispatch queue after firing. To reuse an event, keep a reference and call resetDelayedEvent(). If delayTimeSeconds is negative, the event is created but not scheduled to run, resetDelayedEvent() must be called.
Descriptive name for the event for debugging purposes.
Optionalcallback: () => voidOptional callback to automatically bind to the event.
The time in seconds to wait before firing the event, or negative to create without scheduling.
The created delayed event.
Creates an event that fires during the LateUpdate phase (after all Update events). Higher priority values (larger numbers) will be processed earlier in the late update cycle.
Descriptive name for the event for debugging purposes.
Optionalcallback: () => voidOptional callback to automatically bind to the event
Optional priority value (default: 0). Higher values run first.
The created late update event.
Creates an event that fires during the Update phase. Higher priority values (larger numbers) will be processed earlier in the update cycle.
Descriptive name for the event for debugging purposes.
Optionalcallback: () => voidOptional callback to automatically bind to the event
Optional priority value (default: 0). Higher values run first.
The created update event.
ProtecteddispatchProtecteddispatchProtectedexecuteProtectedexecuteSchedules a callback to be executed on the next frame.
Name for the event (useful for debugging)
The function to execute on the next frame
The created delayed event, which can be cancelled with removeEvent if needed
ProtectedonProtectedonMarks an event for removal from the dispatcher. The event will be removed during the next dispatch cycle.
The event to remove (can be an update, late update, or delayed event)
Reschedules a delayed event with a new delay time. If the event is currently scheduled, it will be removed from the heap first. If delayTimeSeconds is negative, the event is unscheduled without being rescheduled.
The delayed event to reschedule.
The new time in seconds to wait before firing the event, or negative to unschedule without rescheduling.
Changes the priority of an existing late update event. The event will be reordered in the execution sequence according to its new priority.
The late update event to modify.
New priority value. Higher values run first.
Changes the priority of an existing update event. The event will be reordered in the execution sequence according to its new priority.
The update event to modify.
New priority value. Higher values run first.
The UpdateDispatcher manages different types of events (Update, LateUpdate, and Delayed) with priority-based execution ordering. It uses object pooling for memory efficiency and provides a safe API for scheduling, prioritizing, and removing events.