unity-roject-test/workspace/guides/compiling-without-unity/index.page

36 lines
2.8 KiB
Plaintext

<!DOCTYPE html>
<html lang="en"><head>
<meta charset="UTF-8">
<title>Compiling Without Unity — Unity-Roject-Test</title>
<style>
@import url('/fonts/barlow.css');
</style>
</head>
<body data-theme="default-roject">
<page--header></page--header>
<page--root data-theme="default-roject">
<full--width--block data--page--block="">
<full--width--area data--page--area="" contenteditable="true" spellcheck="false" autocorrect="off" autocapitalize="off" style="outline: none;"><h1>Compiling Without Unity</h1></full--width--area>
</full--width--block>
<two--columns--block data--page--block="">
<two--columns--area data--page--area="" contenteditable="true" spellcheck="false" autocorrect="off" autocapitalize="off" style="outline: none;"><h2>Why</h2><div>An agent can verify new C# compiles without opening the Unity Editor, using <code>dotnet build</code> against a project file. Useful when no one is around to press Play.</div><div><br></div><h2>The .NET 10 SDK Crash</h2><div>On this machine, the default .NET SDK (10.0.401) crashes when compiling Unity's generated <code>Assembly-CSharp.csproj</code>, with the error <em>"Your Windows doesn't fully support CET. Please install all available Windows updates."</em> This is a Roslyn/Windows CET (shadow stack) incompatibility, not a project problem.</div><div><br></div><div>Fix: <code>global.json</code> in the project root pins the SDK to an older installed version (8.0.417), which doesn't hit this crash:</div><code--block data-language="rokojori-cs">
<code--area>{
"sdk": {
"version": "8.0.417",
"rollForward": "latestMinor"
}
}
</code--area>
</code--block></two--columns--area>
<two--columns--area data--page--area="" contenteditable="true" spellcheck="false" autocorrect="off" autocapitalize="off" style="outline: none;"><h2>CompileCheck.csproj</h2><div>Unity's own <code>Assembly-CSharp.csproj</code> is regenerated by the Editor and only lists files that existed at the last sync - it will not pick up new scripts written outside Unity. <code>CompileCheck.csproj</code> in the project root is a small hand-maintained sibling project for exactly this: it globs <code>Assets\Scripts\Rokojori\**\*.cs</code> and <code>Assets\Scripts\Project\**\*.cs</code> directly, referencing the same Unity DLLs, so it always covers whatever exists on disk.</div><div><br></div><div>To check the whole Rokojori/Project codebase compiles:</div><code--block data-language="rokojori-cs">
<code--area>dotnet build CompileCheck.csproj
</code--area>
</code--block><div>This only proves the code compiles against Unity's managed API surface - it does not run anything. It cannot catch runtime-only issues (missing scene references, inspector wiring, play-mode behaviour). Use the Unity Editor for that.</div></two--columns--area>
</two--columns--block>
</page--root>
<page--footer></page--footer>
</body></html>