Skip to content

Blazor Configuration ​

Set 2dog properties in MyGame.blazor/Client/MyGame.blazor.Client.csproj. The client references 2dog.engine, 2dog.blazor, and 2dog.browser-wasm. It normally sets GodotProjectDir=../..; see the global settings.

Client Properties ​

PropertyDefaultPurpose
TwoDogWebVariantdebug in Debug, editor in Editor, release otherwiseNative Web engine; explicit settings override the default. The editor variant is unsupported
TwoDogExportPacktrueExport the game pack as a static web asset; false uses an existing wwwroot/godot.pck in the client
TwoDogWebExportPresetWebPreset in export_presets.cfg
TwoDogWebPackNamegodot.pckExported pack name; match it in GodotView.PackUrl if changed
TwoDogWebSideModuleExportstrueExport native symbols used by GDExtensions
WasmEmitSymbolMapfalse in Release, true otherwiseInclude native symbols for stack traces; explicit settings override the default
WasmInitialHeapSize256MBInitial memory allocation; memory can grow

2dog.browser-wasm restores both supported native variants; a missing selected payload fails the build. The client SDK manages its own bundle, progress, source maps, and compression. TwoDogWebSizeManifest, TwoDogWebStripMaps, and TwoDogWebPrecompress are settings for Web/WebXR hosts.

Publishing, Trimming, and AOT ​

Publish the server project to include its client:

bash
dotnet publish MyGame.blazor -c Release -p:RunAOTCompilation=true

RunAOTCompilation enables Mono's browser AOT compiler. The generated client preserves the game, host, GodotSharp, and twodog assemblies. Add <TrimmerRootAssembly Include="MyLibrary"/> in an <ItemGroup> for other assemblies accessed only through reflection.

Keep PrivateAssets="all" on the client's engine and browser package references so their build targets stay out of the server; the generated engine reference also sets Publish="true" so its managed assemblies remain in the client publish. See the Blazor host guide for GodotView and static asset serving.