What order are Controllers and Pawns/Characters instantiated?

During recent work on creating custom derived classes from PlayerController and Character, I ran into some nullpointer problems. Can anyone explain in clear manner, or point to clarifying documentation or other resource, that explains what is the sequence of events (a diagram/simple schematic would help) when we create a new controller and a new pawn/character. Who gets instantiated first, when possession takes place etc. As I just explained, several times when creating subobjects or trying to access each class so that the two objects can communicate with each other, I ran into exceptions, where the pawn/character reference wasn’t there yet and ready to be read etc.


Is this what you ar looking for?
Actor Lifecycle


Thanks but no… this doesn’t mention anything specifically about Controllers and their relation to their Pawns/Characters I’m afraid.

You could test by logging something in each constructor/possess function to see the order.

Hey, I’ve been learning a lot from this online course: https://www.udemy.com/course/unrealvr

If you don’t want to watch the videos, you can see the source here: https://github.com/UnrealVR/1_Architecture_Explorer/blob/master/ArchitectureExplorer/Source/ArchitectureExplorer/VRCharacter.cpp

A common pattern I’ve seen is to make classes in C++ with UPROPERTY’s, then make a blueprint from the C++ class to allow those properties to be configured in the editor. E.g. the DestinationMarker (see cpp file above) can be set to a static mesh and saved in a blueprint in the editor.

Abdul’s suggestion to UE_LOG in the constructors is a good one.

For sure, I know I can do that, and probably what will end up doing to fully understand, but I was wondering whether there was some official resource anywhere to read and understand how the engine’s logic works about these things. Anyway, many thanks for taking the time to respond!