Skip to content

EventHelper Class

Debug only helper methods for events.

C#
public static class EventHelper

Inheritance object

WarnIfLeftOverSubscribers(T, string, Object?)

Section titled “WarnIfLeftOverSubscribers(T, string, Object?)”

Helper method that warns if the given delegate has any subscribers left.

This method is removed in non-debug builds, but you don’t need to explicitly remove it yourself.

C#
[Conditional("DEBUG")]
public static void WarnIfLeftOverSubscribers<T>(T action, string parameterName, Object? targetObject = null)

action T
The delegate to check.

parameterName string
The name of the delegate that will be used in the message.

targetObject UnityEngine.Object
Optional target object to ping when the log is selected.

This method only does something in DEBUG builds.