Say I have several things that need to keep track of a single value. For instance, a UI widget, the boss, and a spawnable item all need to know how many enemies are left. When an enemy dies I would just decrement the variable on the Game Mode or level BP, then check it on tick from every location.
But someone claimed that using an event dispatcher on each enemy when they die to update each item’s local value is better because it’s less demanding. But it seems like there could be two problems.
-
isn’t listening for an event dispatcher also listening on every tick? Is there a significant difference? (especially when there are many event dispatchers, one for each enemy)
-
Doesn’t that introduce the possibility of bugs when each thing maintains its own value rather than getting it from a single source?