Both the Unit and UnitRagdollSpawner are listening to the HealthSystem.OnDead event. Just code execution wise, it seems like we don’t control the order those are fired in, but these are actually linked events. Would it be better to invoke the ragdoll instantiation from the Unit when it dies? Yes this is coupling events, but these events seem like they should be dependent.
We’re pulling info about the Unit about the transforms for instance, but I would think we don’t actually know if the unit still exists because the OnDead method may have been called on it already?
In my own implementation for instance. All I have Unit.HealthSystem_OnDead doing is calling the Unit.Die() method, where I actually handle whatever I need there. Without the tutorial, I would have though I need to get the UnitRagdollSpawner in the Unit script and call it from the Unit.Die() method.
Does this matter, am I missing something down the line, or am I getting off into the weeds?