-
Notifications
You must be signed in to change notification settings - Fork 0
Environments
An Environment is a named configuration that bundles one Service List with optional overrides for the Bootstrap Handlers that run around it. It's the piece that actually gets bootstrapped in play mode or in a build. Different scenes, platforms, or build profiles can each be mapped to a different environment, which is how a single project can boot a different set of services depending on context, without touching any code.
Assets > Create > Bootstrap > Environment Asset
A BootstrapEnvironmentAsset exposes three fields:
- Service List Asset — the Service List this environment bootstraps. An environment with no Service List assigned, or one whose list has zero entries, is a no-op.
- Pre Bootstrap Handler / Post Bootstrap Handler — optional per-environment overrides for the two Bootstrap Handlers, assigned the same polymorphic-dropdown way you add a service to a Service List.
Multiple environments can point at the same Service List, or each have their own. There's no partial-override or merge behavior between environments; picking a different one swaps the whole Service List and handler pair wholesale.
An environment asset on disk is never bootstrapped directly. The moment it's selected for a session, it's cloned along with its Service List, so the project asset itself is never mutated by a play session or a build.
Which environment actually runs depends on context.
- The environment currently selected in the Bootstrap Settings Window's User tab, if one is set.
- Otherwise, the environment mapped to the active scene. Every Scene asset's inspector gains a Bootstrap Environment field for exactly this.
- Otherwise, the project's Default Play Mode Environment (see Bootstrap Settings).
- If none of these resolve to anything, play mode starts on the active scene directly, with no redirect and no service bootstrap.
This resolution happens once, at the moment you press Play. See Bootstrap Flow for how the resolved environment carries through the rest of the flow.
A build's environment is set from a Bootstrap Environment field on either the newer Build Profile window or the classic Build Settings window. Bootstrap packs the resolved environment into the player's preloaded assets before compiling, then strips it back out again once the build finishes, so it doesn't linger in your project's Player Settings.
- If the active Build Profile has an environment mapped, that one is used.
- Otherwise, the classic per-platform mapping for the current build target is used.
- If neither resolves, no environment ships with the build, and a warning is logged.
If an environment supplies a Pre or Post Bootstrap Handler, it replaces the platform default for that slot entirely, it doesn't run alongside it. See Bootstrap Handlers for what runs when an environment doesn't supply its own.
Edit mode itself (as opposed to play mode) has no concept of an environment at all. It bootstraps the standalone Edit Mode Services list instead, independent of anything described on this page. See Edit Mode Bootstrapping.