P3SampleApp Boot Sequence

Studying the boot sequence is important to learn where a P3 application starts in the code.

The boot sequence is necessarily abbreviated because the P3 SDK itself is not open source. There is still a lot of information we can get from the P3SampleApp source code using simple breakpoints.

This is the boot sequence when P3SampleApp starts:

Execution starts 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 the display

P3SABaseGameMode is started

AttractMode is started

The Attract scene is loaded (by GUI thread)

Start button is pressed and a player is added

AttractMode stops

Game intro plays if applicable

HomeMode starts

Everything before P3SABaseGameMode is boilerplate.

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

Afterwards, you can go back to AttractMode.