-
Notifications
You must be signed in to change notification settings - Fork 0
Home
A rock-solid mechanism for consistent, testable, and configurable application bootstrapping for Unity.
github.com/thebeardphantom/Bootstrap · MIT License · C#
Bootstrap is a dependency injection and service locator framework for Unity. Time and time again developers hit the same issues in the Unity projects core architecture:
- Their game code attempts to use services before they've been created (i.e. during
Awake/Start). - Entering play mode isn't as simple as hitting Play. Most projects either require opening a dedicated bootstrap scene before entering play mode, or have their own custom "enter playmode" menu item which does that for you. Even with such a mechanism, you then have to navigate (in play mode) to whatever scenes you were working on in edit mode.
Bootstrap addresses both of these directly:
You can hit Play from whatever scenes you're editing and Bootstrap will run its consistent initialization flow before automatically loading the scenes you had open in edit mode. Services are defined in project-wide assets which can be edited anywhere easily. The consistent bootstrapping mechanisms ensure that your game code doesn't have to deal with service null checks, guessing at initialization order, or defensive workarounds for "is this ready?"
This library prioritizes features being documented in code, rather than on this wiki. This prevents information from getting out of sync with code changes.
- Concepts: high-level details about the design and philosophy of Bootstrap.
- Quick Start: set up a new project and get your first service running.
- Services: how to write a service, accessing services, and how Service List assets are created and used.
-
App and AppInstance: the static
Appentry point and the per-sessionAppInstancebehind it. - Bootstrap Flow: what happens from pressing Play through full game bootstrap, and back.
-
Source Generation: the
[GenerateSingleton]and[GenerateLogger]attributes. - Bootstrap Settings: the Project Settings window, and how Project/User overrides work.
MIT License.
AI was used to assist in generating this wiki and the codebase's code documentation. Both were iterated on by hand and reviewed for accuracy.