Not sure I understand. You mean, you can share data between actors that have the same actor component?
All right, tested
It’s exactly the same idea, except it just takes a look to see if someone is listening or sending before adding to the lists ( 2 lists now )
As a bonus, the gauge gets the tank actor reference.
Inside the tank
and the gauge
ultimately i think its better not to use BeginPlay for this stuff.
eventually you will likely have some sort of load screen. use BeginPlay to initialize the class and then notify the LoadScreen (manager class) its ready.
then have another Event ‘PreLoad’ called once all classes are ready, at this point you know you can get a reference to any item and that that item is fully initialized not just spawned. after that call PostLoad and the game can begin properly.
Can you please let me know why did you put a “Delay Until Next Tick” after Event BeginPlay?
But how do you know when all actors are ready? How can you count, if you don’t know how many they might be in total?
This just helps ensure the class has fully initialized. 1 more frame/tick before doing anything.
thats the difference between exists and ready. unless you’re spawning dynamically all actors should exist at the time of BeginPlay, but they may not be ready.
on beginplay you can add an object to the load list, and after you’ve done whatever initialization you need you can remove it from a loadlist and call ready.
there are also world events you can use UWorld::SpawnActor
you can also just check for managers directly from your load manager. (make a list in editor)
you can bind to the ready signal for specific things, say you have a manager class that you need to know when ready.
you should also know whether its a first time load or load from save, this is likely handled in your Game Instance so it should be know before GameMode Beginplay. If you’re loading you may need something like GetAllActorsWithSaveGameInterface.