Order of construction for actors created by the GameMode

I’m having a bit of trouble setting up some initialization logic in the actors created by the GameMode (i.e. PlayerController, PlayerState, HUD, etc.). I’d like each of those actors to have a set of events that get dispatched at various times, and others of these actors can listen to them. For example:

  • My HUD class has an event dispatcher, “OnSomeButtonClicked,” and my PlayerController wants to listen for that event and respond appropriately. I tried to bind to that event from my PlayerController’s OnBeginPlay. However, at this time, the HUD actor doesn’t exist yet, so GetHud returns None.
  • My HUD class would like to get keep a reference to the local player’s PlayerState so that I don’t have to cast it to the derived PlayerState class that I’m actually using everywhere I want to use it. I tried to set this up in my HUD’s OnBeginPlay, but again, the PlayerState doesn’t exist at that time.

In other engines I’ve used, there is a callback that actors receive after all actors in the level have been created but before any of them have begun to tick. (Similarly, for each actor, each of its components receive a callback when all of the other components on that actor have been created but haven’t begun to tick). This enables all components to do any necessary wiring after all of their dependencies are guaranteed to exist. I haven’t been able to find anything like that in Unreal, but I’d be very surprised if such a thing didn’t exist; I’m guessing that I just don’t know what to look for. Is there an event I can respond to that is fired when all actors in a level have been loaded and all components are guaranteed to exist?

Alternatively, is there any place where I can specify the order of construction for the actors that are spawned by the GameMode? This would be less ideal than finding the event I was looking for above, but as long as I don’t have any cyclical dependencies, I could use this to make sure that every object is created after the objects to which it needs to keep references/bind to events.

Thanks for any help!

+1. I’d like to know this as well, I usually end up adding a small delay before initializing anything, but that seems hacky.