Change EventManager DelListener

This commit is contained in:
hyunwoo 2023-08-16 19:28:41 +09:00
parent bc6e1a3fd3
commit 84e34e84fd

View File

@ -34,16 +34,17 @@ namespace FirstVillain.Event
if (_delegateDict.TryGetValue(type, out EventDelegate tempDelegate)) if (_delegateDict.TryGetValue(type, out EventDelegate tempDelegate))
{ {
tempDelegate -= targetDelegate; tempDelegate -= targetDelegate;
if (tempDelegate == null) if (tempDelegate.GetInvocationList().Length == 0)
{ {
_delegateDict.Remove(type); _delegateDict.Remove(type);
_delegateLookupDict.Remove(callback);
} }
else else
{ {
_delegateDict[type] = tempDelegate; _delegateDict[type] = tempDelegate;
} }
} }
_delegateLookupDict.Remove(callback);
} }
} }