P3SampleApp Boot Sequence

Studying the boot sequence is important for understanding where execution begins in a P3 application.

The P3 SDK is not open source. We can still learn a great deal from the P3SampleApp source code using simple breakpoints.

This is the boot sequence when P3SampleApp starts:

Execution begins on the GUI thread provided by Unity

Bootstrap scene is loaded

BootstrapSceneController script component is created

BootstrapSceneController sets the appCode to P3SA

The P3SASetup.prefab is loaded

The P3SASetup script component is created

The P3SAAudio.prefab is loaded

The P3SAAudio script component is created

P3Controller is created

P3SABaseGameMode is created

Execution continues on the mode thread while the GUI thread handles rendering

P3SABaseGameMode starts

P3SAAttractMode starts

The Attract scene is loaded by the GUI thread

Start button is pressed and a player is added

P3SAAttractMode stops

HomeMode starts

Everything before P3SABaseGameMode is boilerplate.

Therefore, when studying a P3 application, start with P3SABaseGameMode and HomeMode.

Afterwards, you can go back to P3SAAttractMode.