Info
- Boots the app: loads the setup, instantiates managers, preloads definitions, settings and localization, starts the network and spawns the menu
- Code in
Polis.Core.AppLoading (Packages/PolisCore/AppLoading), shared data in the content kit Packages/PolisXrContentKit/App/AppLoading/Data/ (load items, categories, DefaultLoadSetup)
AppLoaderController lives in RootScene next to AppCore. On Start it registers itself as a service, waits until the boot screen is on screen, loads its LoadSetupDefinition, runs it, calls AppCore.SetLoadCompleted() and destroys itself
- Each project owns its RootScene (starter: kit
Settings/SceneTemplates/RootSceneTemplate)
- Always play from RootScene: toolbar button Polis/Play Root Scene. The root scene path is set in Project Settings > App Loader (asset
Assets/Settings/LoaderSettings.asset)
- Headless players (dedicated servers,
-nographics) cap the frame rate at 60 and skip the client-only load items, see Example
Adding a new manager
- Create a prefab with your
ALoadableServiceBehaviour<T> on the root
- Loadables on child objects are not supported. The validator offers a fix that adds
PrefabChildLoadableProvider on the root and lists the child there
- Create a
LoadItemDefinition asset, set Source to PrefabLoadItemSource and assign the prefab
- Press Refresh Resolved Data
- Add categories (e.g.
Services) and category dependencies (e.g. Boot)
- Add the item to the project's Load Setup
- Check the Odin Validator for errors
Structure
- Load items form a Directed Acyclic Graph (DAG), edges are dependencies
- https://en.wikipedia.org/wiki/Topological_sorting
- Items that don't depend on each other are loaded in parallel
- Flow:
LoadSetupDefinition → flat list of LoadItemDefinitions. All start in parallel, each waits for its dependencies
- Dependencies are typed (declared in code) or by
LoadCategoryDefinition (all items of a category)
- All three are
AUniqueDefinition ScriptableObjects (stable UniqueID from file name)