GameApplicationBuilder Class
Builder for configuring and creating a game application.
public sealed class GameApplicationBuilder
Inheritance System.Object → GameApplicationBuilder
Remarks¶
Default logging is Console at Microsoft.Extensions.Logging.LogLevel.Information; all providers added by Microsoft.Extensions.Hosting.Host.CreateApplicationBuilder are cleared so the engine starts from a known baseline. Override via Logging before calling Build().
| Properties | |
|---|---|
| HostEnvironment | Gets the host environment. Use this to branch behaviour between Development and Production at startup. |
| Logging | Gets the logging builder. |
| Services | Gets the service collection. |
| Methods | |
|---|---|
| AddDefaultSystem<T>() | Adds a system to every scene's entity world, equivalent to calling world.AddSystem<T>() in ConfigureScene(Action<IEntityWorld>). Can be excluded project-wide with ExcludeDefaultSystem<T>(). Can be called multiple times; additions are additive. |
| AddDefaultSystem<T>(Action<T>) | Adds a system to every scene's entity world with an initial configuration delegate. Can be excluded project-wide with ExcludeDefaultSystem<T>(). |
| AddScene(Type, bool) | Registers a scene by runtime type. Used internally by AddRange(ReadOnlySpan<Type>). Prefer AddScene<T>() for compile-time type safety. |
| AddScene<T>() | Registers a scene and defers dependency validation to Build(). Registration is optional; unregistered scenes can still be loaded via ActivatorUtilities. |
| AddScenes(Action<SceneBuilder>) | Configures scenes using a fluent builder. |
| Build() | Builds the game application. Can only be called once per builder instance. |
| Configure(Action<Brine2DOptions>) | Configures Brine2D options. |
| ConfigureBrine2D(Action<Brine2DBuilder>) | Configures optional Brine2D subsystems via Brine2DBuilder. Can be called multiple times; delegates are additive. |
| ConfigureScene(Action<IEntityWorld>) | Configures the entity world for every scene loaded during this game's lifetime. Called after default systems are added, so you can disable, replace, or extend them. Can be called multiple times; delegates are additive. |
| ExcludeDefaultSystem<T>() | Prevents a default engine system from being registered in every scene's world. Use this when a system is never needed project-wide and you want to avoid its construction cost entirely. To conditionally disable a system at runtime instead, use ConfigureScene(Action<IEntityWorld>) with world.GetSystem<T>()!.IsEnabled = false. Can be called multiple times; exclusions are additive. |
| SelectBestConstructor(ConstructorInfo[], HashSet<Type>, HashSet<Type>) | Mimics the Microsoft.Extensions.DependencyInjection.ActivatorUtilities constructor selection algorithm: prefer the constructor with the most parameters where every parameter is resolvable, then fall back to the constructor with the most total parameters. |
| UseFallbackScene<T>() | Replaces the built-in DefaultFallbackScene with a custom scene shown when a scene load fails and SceneLoadFailed has no handler that queues a recovery transition. The fallback scene can inject ISceneLoadErrorInfo to display the failure details. |