I’m trying decide what would be the better communication method for changes like to a players health ect. At the moment I use Get All Actors with Interface, and I have an Interface that informs all relevant actors of a change in players health. I did it this way mostly because using event dispatchers were a pain because I needed to bind each one. But I’m wondering if this is a good practice and is going to bite me down the road. Any thoughts? (Mostly, the ‘slow’ part in the description Get All Actors with interface worries me…)
How many actors do you have? If it’s a dozen, then looking through them all every tick might not be so bad. If you have hundreds, or thousands, then yeah, looking through each of them, asking each of them “hey, do you support IHealth?,” just to get the one or two you care about, is not so good.
If you don’t want to use event dispatchers, then I suppose you could create some component on the level, or the game mode, which things can tell about health. Your character would then tell it “I’m the player character and my health is X” each time the health changes – push, instead of pull.