Return Values in Live Event Debugging
When triggering delegates with return types (such as Func<T>
, Predicate<T>
, or custom delegates), InspectMe provides an inline display of the return value directly within the inspector.
This page explains how return values are handled, especially when multiple listeners are involved, and clarifies InspectMe's behavior in accordance with how .NET delegates operate under the hood.
How Return Values Are Handled
If the target delegate returns a value (non-void
), the result is captured and displayed immediately after invocation.
Examples of supported return scenarios:
Func<int> GetHealth
→ Displaysint
resultFunc<string, bool> IsNameValid(string name)
→ Displaysbool
resultPredicate<GameObject> IsActive
→ Displaysbool
result- Custom delegate returning any object → Displays the object (inspectable if supported)
Multiple Listeners: Which Return Value Is Used?
When an event or delegate has multiple subscribers, C# will still only return the result of the last listener invoked.
This behavior is not specific to InspectMe — it's standard in .NET and applies to all MulticastDelegate
types.
Example
Func<int> onGetValue = ListenerA;
onGetValue += ListenerB;
int result = onGetValue(); // result is from ListenerB, not ListenerA
Even though both ListenerA
and ListenerB
are called, only ListenerB
's return is passed back.
InspectMe mirrors this behavior by design.
Why This Behavior Exists
This is an intentional design in the .NET framework. When you call a multicast delegate: - All listeners are invoked in sequence. - Only the final listener’s return value is passed back.
This design works well for Action
-based delegates (which return void
), but may be limiting in some Func
-based patterns.
Viewing Return Values in InspectMe
When a return value is available, InspectMe will display: - An info box indicating a return result exists. - The raw value inline under the Trigger Event section. - An Inspect button, if the value is complex or inspectable via Tree View.
Return values remain visible until the next trigger or selection change.
Summary
- Return values are fully supported for
Func
,Predicate
,Comparison
, and other non-void delegates. - Only the final listener's return value is displayed — as per .NET delegate behavior.
- Complex return types are inspectable via the inspector.
- Multi-result debugging is not yet available but can be implemented manually.
For supported delegate signatures and detailed compatibility, refer to the Supported Event Types page.