"Assembly.cs global usings as project bootstrap"
- C# can't find your Razor panels (
Hudnot found). - Every file needs the same
using Sandbox;/using System.Linq;boilerplate or won't compile. - Razor resolves Sandbox built-ins over your types.
Code/Assembly.cs is the assembly-wide global usings file. Razor classes do not land in the global namespace — they need @namespace YourGame and global using YourGame; here, or the rest of the project can't see them (razor-namespace-trap).
global 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 every .razorIn every .razor:
@namespace YourGame
@inherits PanelComponentcsproj notes: TargetFramework net10.0, Razor via Microsoft.NET.Sdk.Razor, references Steam s&box managed DLLs. Verify with:
dotnet build Code\<project>.csprojDon't name gameplay classes after Sandbox built-ins (PlayerController, etc.) — Razor prefers Sandbox.* and you get baffling "no such member" errors.
Global usings apply to every compilation unit in the game assembly. Matching global using to Razor's @namespace puts generated panel types in the same scope as your components, which is the whole point of a single Assembly.cs bootstrap file.