Skip to content

EventBus API ​

This page summarizes the public EventBus surface area as used by Event Monitor. Names and signatures follow the Unity package; always verify in your installed version.

Namespace: EventMonitor.Runtime

Runtime settings ​

MemberPurpose
IsRecordingWhen false, new records are not appended.
EnablePayloadCaptureWhen true, payload capture paths are active (toolbar + TagPayload).
CaptureStackTracesWhen true, new records may include stack traces (higher overhead).
CaptureInvokeTimingWhen true, IL-injected Begin/End timing records DurationMs on INVOKE rows and emits Profiler markers.

Editor session persistence of these flags is handled by Editor-only settings code.

Manual recording (advanced) ​

These are safe to call from custom tooling or tests. Game code usually relies on ILPP instead.

MethodUse
RecordSubscribe(eventName, ownerType, ownerInstanceId, subscriberType, subscriberMethod)Append a SUB row and update live state.
RecordUnsubscribe(...)Append an UNSUB row and update live state.
RecordInvoke(eventName, ownerType, ownerInstanceId, subscriberCount, parameters, parameterNames)Append an INVOKE row with optional parallel parameter names.

Payload tagging ​

MethodUse
TagPayload(params object[] args)Attach argument values to the next invocation on this thread when payload capture is enabled. Names use UI fallbacks unless set via TagPayloadWithNames.
TagPayloadWithNames(string[] names, object[] args)Attach named payload to the next invocation (used by ILPP; available for custom dispatch).

Injected entry points (do not call from gameplay) ​

ILPP injects calls to static helpers such as:

  • RecordSubscribeDelegate(string eventName, string ownerType, int instanceId, Delegate handler)
  • RecordUnsubscribeDelegate(...)
  • RecordInvokeDelegate(string eventName, string ownerType, int instanceId)
  • BeginInvokeTiming(string eventName) / EndInvokeTiming(string eventName) — bracket instrumented Invoke() for duration capture.

They are not intended for manual use; they exist so rewritten IL can report activity with stable signatures.

Warning: Relying on injected methods from hand-written code is fragile and may break across package updates.

UI integration ​

MemberPurpose
OnRecordAddedRaised when a record is appended (Editor window repaints).

Stats and queries ​

The package exposes counters and ring-buffer stats (for example total records, invoke counts) for the Stats tab and toolbar. Exact property names may vary by version — inspect EventBus in your IDE.

Leak detection ​

MemberPurpose
EventMonitorLeakDetector.DetectedLeaksRead-only list of detected subscription leaks.
EventMonitorLeakDetector.LeakCountNumber of unique detected leaks.
EventMonitorLeakDetector.ScanNow()Force a leak scan (tests / manual refresh).

Exception breadcrumbs ​

MemberPurpose
EventMonitorExceptionBreadcrumbs.GetBreadcrumbs()Read captured Play Mode exceptions with preceding timeline records.
EventMonitorExceptionBreadcrumbs.BreadcrumbCountNumber of stored exception entries.

Subscriber growth alerts ​

MemberPurpose
EventMonitorSubscriberGrowthMonitor.RecentWarningsRead recent growth warnings.
EventMonitorSubscriberGrowthMonitor.WarningCountNumber of warnings in the recent list.
EventMonitorSubscriberGrowthMonitor.Threshold / MinGrowthStreakRuntime thresholds (Editor UI persists via EditorPrefs).

See also ​

Event Monitor — Unity Editor documentation