Fixes optimization and UI/UX updates
This commit is contained in:
@@ -15,7 +15,23 @@ namespace Darkmatter.Libs.Observer
|
||||
if (_map.TryGetValue(typeof(T), out var handlerObj))
|
||||
{
|
||||
var action = (Action<T>)handlerObj;
|
||||
action?.Invoke(evt);
|
||||
if (action == null) return;
|
||||
|
||||
// Invoke handlers one by one: a multicast invoke would let one throwing
|
||||
// subscriber silently starve every later subscriber and rethrow into the
|
||||
// publisher (paint / scene-transition code), turning a local bug into a
|
||||
// stuck flow.
|
||||
foreach (var handler in action.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
((Action<T>)handler).Invoke(evt);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UnityEngine.Debug.LogException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user