UE4 Game Lifecycle

I’m learning UE4 (coming from Unity), and I’d like to better understand the game lifecycle.

So far, I’ve seen the following links:

Specifically, I’m trying to understand the general flow of engine startup/shutdown, and what callbacks/events i can respond to programmatically.

*The actor lifecycle seems to be related to an actor, but not generally to the entire engine.

Is there any page or tutorial i can check out to better understand this ?

Check this in the Unreal online documentation:

And especially this part:

My own advice is to remember these points:

  • The Game Instance is born when the game starts up, and survives until the game closes.
  • Most of the other parts, as far as I know, are Actors, and exist in the World. When the World is destroyed, (like when you change levels, for example) They are destroyed too, and have to be created again when there is a new world created for them as the next level opens.
  • As far as I know, Players are objects that can survive level changes, but Player Controllers are Actors and have to be destroyed and created between levels, and assigned to the Players.
  • The rules of the game should be programmed in the GameMode. GameMode only exists on the server in multiplayer, and other computers cannot see it.
  • GameState can communicate over multiplayer network to the other connected players, and contains a list of PlayerStates.
  • PlayerControllers don’t fully replicate across multiplayer network. Clients cannot see other machines’ player controllers, only the server can.
  • PlayerStates do. Clients CAN see other machines’ playerstates because the server replicates to them.
  • Anything that is an actor has a Constructor that runs every time you place it in the world with the editor, move it in the editor, or spawn it at runtime. They also have a BeginPlay event that fires only when the actor enters the world during runtime.
  • Every Level is also an Actor and has a blueprint and a beginplay, etc.
  • Every Actor has both a destructor and an Endplay.
  • Unreal is object-oriented and hierarchical. You can run a child class’ parent function as well as its own.
  • The world consists of a chain of references and owners of actors, it seems like. The engine has a garbage collector which over time, deletes actors that are no longer referenced by any other actor.

That’s all I can think of for now.

1 Like