# What order are Controllers and Pawns/Characters instantiated?

**URL:** <https://forums.unrealengine.com/t/what-order-are-controllers-and-pawns-characters-instantiated/460003>\
**Category:** Editor Scripting\
**Tags:** playercontroller, reference, nullptr, unreal-engine, question\
**Created:** [December 29, 2019, 12:54pm UTC](https://forums.unrealengine.com/t/what-order-are-controllers-and-pawns-characters-instantiated/460003 "2019-12-29T12:54:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodingRook](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CodingRook](https://forums.unrealengine.com/u/CodingRook)\
**Post date:** [December 29, 2019, 12:54pm UTC](https://forums.unrealengine.com/t/what-order-are-controllers-and-pawns-characters-instantiated/460003/1 "2019-12-29T12:54:28Z")

</div>

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.

Thanks!

---

<div class="post-metadata">

**Author:** ![blindminds](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/blindminds/32/1213160_2.png) [@blindminds](https://forums.unrealengine.com/u/blindminds)\
**Post date:** [December 29, 2019, 6:08pm UTC](https://forums.unrealengine.com/t/what-order-are-controllers-and-pawns-characters-instantiated/460003/2 "2019-12-29T18:08:06Z")

</div>

Is this what you ar looking for?  
Actor Lifecycle

> **[Actor Lifecycle](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/Actors/ActorLifecycle/)**
>
> What actually happens when an Actor is loaded or spawned, and eventually dies.

[https://docs.unrealengine.com/Images/Programming/UnrealArchitecture/Actors/ActorLifecycle/ActorLifeCycle1.jpg](https://docs.unrealengine.com/Images/Programming/UnrealArchitecture/Actors/ActorLifecycle/ActorLifeCycle1.jpg)

---

<div class="post-metadata">

**Author:** ![CodingRook](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CodingRook](https://forums.unrealengine.com/u/CodingRook)\
**Post date:** [December 29, 2019, 11:51pm UTC](https://forums.unrealengine.com/t/what-order-are-controllers-and-pawns-characters-instantiated/460003/3 "2019-12-29T23:51:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Abdul\_Hasan\_Ali](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Abdul\_Hasan\_Ali](https://forums.unrealengine.com/u/Abdul_Hasan_Ali)\
**Post date:** [January 9, 2020, 8:29pm UTC](https://forums.unrealengine.com/t/what-order-are-controllers-and-pawns-characters-instantiated/460003/4 "2020-01-09T20:29:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![FunAndFriendly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FunAndFriendly](https://forums.unrealengine.com/u/FunAndFriendly)\
**Post date:** [January 9, 2020, 10:33pm UTC](https://forums.unrealengine.com/t/what-order-are-controllers-and-pawns-characters-instantiated/460003/5 "2020-01-09T22:33:36Z")

</div>

Hey, I’ve been learning a lot from this online course: [https://www.udemy.com/course/unrealvr](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](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.

---

<div class="post-metadata">

**Author:** ![CodingRook](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CodingRook](https://forums.unrealengine.com/u/CodingRook)\
**Post date:** [January 11, 2020, 6:38pm UTC](https://forums.unrealengine.com/t/what-order-are-controllers-and-pawns-characters-instantiated/460003/6 "2020-01-11T18:38:05Z")

</div>

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!
