feat: safe delegate invocation helper added
This commit is contained in:
@@ -63,12 +63,12 @@ public class ActiveBehaviourCollector<T> : IBehaviourCollector<T> where T : clas
|
||||
{
|
||||
activeBehaviours.Add(behaviour);
|
||||
OnBehaviourAdd(behaviour);
|
||||
OnCollected?.Invoke(this, behaviour);
|
||||
OnCollected?.InvokeSafe(this, behaviour);
|
||||
}
|
||||
else if (activeBehaviours.Remove(behaviour))
|
||||
{
|
||||
OnBehaviourRemove(behaviour);
|
||||
OnRemoved?.Invoke(this, behaviour);
|
||||
OnRemoved?.InvokeSafe(this, behaviour);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ActiveBehaviourCollector<T> : IBehaviourCollector<T> where T : clas
|
||||
if (activeBehaviours.Remove(tBehaviour))
|
||||
{
|
||||
OnBehaviourRemove(tBehaviour);
|
||||
OnRemoved?.Invoke(this, tBehaviour);
|
||||
OnRemoved?.InvokeSafe(this, tBehaviour);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class ActiveBehaviourCollector<T> : IBehaviourCollector<T> where T : clas
|
||||
gameManager.OnHierarchyObjectUnRegistered += OnHierarchyObjectUnregistered;
|
||||
|
||||
GameManager = gameManager;
|
||||
OnGameManagerAssigned?.Invoke(this);
|
||||
OnGameManagerAssigned?.InvokeSafe(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public class ActiveBehaviourCollector<T> : IBehaviourCollector<T> where T : clas
|
||||
GameManager.OnHierarchyObjectUnRegistered -= OnHierarchyObjectUnregistered;
|
||||
|
||||
GameManager = null!;
|
||||
OnUnassigned?.Invoke(this);
|
||||
OnUnassigned?.InvokeSafe(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user