When things run
This set of pages is the order of the framework’s calls, from the game starting to the game closing. Each step says what is safe to call there, and what does not exist yet.
The order in five lines:
- BepInEx preloader patchers run first, before the game loads, and then every plugin’s
Awakeruns. - The framework’s
Startfinds your mod and callsOnLoad, which is where you subscribe to events and register your own things. - The main menu loads, and the framework forgets the session.
- A new game, a save load, a door or level change and every frame each bring their own calls.
- Saving writes your registered data, and quit writes only the settings you changed and the log.
Read them in this order:
- Once or again and again: which calls happen once, which happen again and again, and why
OnLoadonly sets up hooks. - One play session: one small mod followed through a whole session, step by step.
- Starting the game: steps 1 to 4, the preloader, plugin
Awake, the framework’sStartandOnLoad, and the main menu. - Loading and playing: steps 5 to 8, a new game, loading a save, a door or level change, and every frame.
- Saving and quitting: steps 9 and 10, saving and quit.
- Which hook should I use: a table that matches a job to the call to use.
Where to go next
Back to Using events for the clock, scene and save events, or to Save data for per-save data.