"Getting set up: new project skeleton"
Empty or half-copied project won't Play, Razor can't find types, or you're unsure what the minimum viable folder layout is.
s&box projects are a small, opinionated tree: manifest, assets, code assembly referencing the Steam install, and a tiny startup scene that bootstraps the rest in code.
Folder layout
<project>/
├── <project>.sbproj
├── Assets/
│ ├── scenes/*.scene
│ ├── models/…
│ └── materials/…
├── Code/
│ ├── Assembly.cs
│ ├── <project>.csproj
│ └── <domain>/*.cs + UI/*.razor(.scss)
├── Editor/
├── ProjectSettings/
│ ├── Input.config
│ └── Collision.config / Platform.config
└── tools/ # optional python generators.sbproj essentials
{
"Title": "YourGame",
"Type": "game",
"Org": "local",
"Ident": "yourgame",
"Schema": 1,
"Metadata": {
"MaxPlayers": 64,
"MinPlayers": 1,
"TickRate": 50,
"GameNetworkType": "Multiplayer",
"StartupScene": "scenes/main.scene"
}
}TickRate: 50→ fixed update 50 Hz.- Keep
GameNetworkType: "Multiplayer"even for single-player (architecture stays open). StartupSceneis what Play loads.
csproj / Assembly.cs
TargetFramework net10.0, referencesSandbox.*.dllunder the Steam s&boxbin/managed/install.- Verify without the editor:
dotnet build Code\<project>.csprojglobal using Sandbox;
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using System.Threading.Tasks;
global using YourGame; // must match @namespace in .razor filesMinimal scene + bootstrap
Scene JSON: exactly four GameObjects — Sun (DirectionalLight), Skybox (SkyBox2D + EnvmapProbe), Camera (CameraComponent, IsMainCamera: true), Bootstrap (custom component, plain __type class name, often namespace-free for scene binding).
protected override void OnStart()
{
if (Scene.IsEditor) return;
// 1. manager singletons (OnAwake publishes .Instance)
// 2. static world
// 3. player
// 4. camera/sun attachments
// 5. UI (one GO: ScreenPanel + PanelComponents)
// 6. game-state last
}Input.config
JSON list of { Name, GroupName, Title, KeyboardCode, GamepadCode }. WASD named Forward/Backward/Left/Right feeds Input.AnalogMove. Underscores must match; press/down/released names are case-insensitive.
Startup checklist
- Folders + Title/Ident/StartupScene in
.sbproj - Assembly.cs globals + razor namespace
- 4-object scene + Bootstrap
dotnet buildgreen- Optional: art generators (blender-headless-pipeline)
- Prefix
Log.Infowith a project tag; watch console each Play
The editor only needs a mountable package + a startup scene. Bootstrap-in-code avoids scene/code drift and matches the lifecycle rules for singletons and UI. Headless dotnet build against the Steam assemblies is the fastest compile gate before you open the editor.