give the runtime code assemblies, a build entry point, and fix two names

No project code is in Assembly-CSharp any more. Five assemblies: Core (no
dependencies), Locomotion.Math, Skills, Game (everything else under Scripts),
and StarterAssets.

Game is one assembly rather than one per area, which is what the plan assumed.
Measuring the dependency graph first found three cycles, all through UI —
CharacterPanelView reaches into Dialogue, PlayerControlLock into Player, and
UILayerBootstrap into Cinematics — plus two edges a using-scan cannot see,
because NPCStandIn is in the global namespace. Assemblies cannot be circular, so
splitting further means relocating those three files. That is a code-movement
task, not an asmdef task, and nothing needs it yet.

StarterAssets had to get an assembly of its own. It had none, so it lived in
Assembly-CSharp, and an asmdef assembly cannot reference the predefined
assemblies — four runtime files use it, and all four would have stopped
compiling.

The payoff is immediate: BootstrapTests no longer needs reflection to reach
NPCStandIn and CinemachineFollowsPlayer, which is exactly why Phase 3 wanted
this.

Assets/Editor/PlayerBuild.cs is the headless build entry point. It reads the
enabled scenes, asserts Bootstrap is scene 0 because the player opens scene 0 on
launch, honours the -buildOutput the CLI forwards from -o, and calls
EditorApplication.Exit(1) on anything short of Succeeded — without which Unity
exits 0 on a build that produced nothing and CI goes green on it. Verified end to
end: a 172MB .app in about two minutes.

Two renames, both different from what the plan described. DialougueSkillComparison.cs
contains a class called SkillFunctions — the filename never matched the type, so
it is now SkillFunctions.cs. The two .yarn files with spaces in their names lost
the spaces rather than becoming kebab-case, which would have made them
inconsistent with Bartender.yarn and SC101.yarn; spaces were the actual problem.
Both renames preserved their .meta GUIDs, and the yarnproject graph keys and the
two character sheets were updated.

EditMode 42/42, PlayMode 5/5, YarnCheck 9 files / 35 nodes, make build green.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
2026-08-25 21:01:27 +02:00
co-authored by Claude Opus 5
parent 40b4547c71
commit bb0f2b760c
27 changed files with 351 additions and 74 deletions
@@ -0,0 +1,123 @@
using System;
using System.Linq;
using UnityEditor;
using UnityEditor.Build.Reporting;
using UnityEngine;
namespace NightclubArcadia.EditorTools
{
/// <summary>
/// Headless player builds.
///
/// Not called "BuildPipeline" on purpose — that name collides with
/// UnityEditor.BuildPipeline, which this has to call.
///
/// The reason to have this at all rather than let the CLI drive Unity's built-in
/// build: a flag-only build reports success even when it produced nothing useful,
/// because Unity exits 0 unless the process itself failed. CI then goes green on a
/// build that does not exist. Every entry point here inspects the BuildReport and
/// calls EditorApplication.Exit(1) on anything short of success.
///
/// unity build NightclubArcadia --target StandaloneOSX \
/// --execute-method NightclubArcadia.EditorTools.PlayerBuild.BuildMacOS \
/// -o build/NightclubArcadia.app
///
/// The CLI forwards -o as -buildOutput, and honouring it is this method's job.
/// </summary>
public static class PlayerBuild
{
public static void BuildMacOS() => Build(BuildTarget.StandaloneOSX, "build/NightclubArcadia.app");
public static void BuildWindows() => Build(BuildTarget.StandaloneWindows64, "build/NightclubArcadia.exe");
public static void BuildLinux() => Build(BuildTarget.StandaloneLinux64, "build/NightclubArcadia");
static void Build(BuildTarget target, string defaultOutput)
{
var output = ArgValue("-buildOutput") ?? defaultOutput;
var scenes = EditorBuildSettings.scenes
.Where(s => s.enabled)
.Select(s => s.path)
.ToArray();
if (scenes.Length == 0)
{
Fail("No enabled scenes in the build settings — the player would have nothing to load.");
return;
}
// Bootstrap loads the others by name at runtime, so it has to be index 0.
if (!scenes[0].EndsWith("/Bootstrap.unity", StringComparison.Ordinal))
{
Fail($"Scene 0 is '{scenes[0]}', expected Assets/Scenes/Bootstrap.unity. " +
"The player opens scene 0 on launch.");
return;
}
Debug.Log($"[PlayerBuild] {target} -> {output}");
foreach (var scene in scenes)
{
Debug.Log($"[PlayerBuild] scene: {scene}");
}
var options = new BuildPlayerOptions
{
scenes = scenes,
locationPathName = output,
target = target,
options = BuildOptions.None,
};
BuildReport report;
try
{
report = UnityEditor.BuildPipeline.BuildPlayer(options);
}
catch (Exception e)
{
Fail($"BuildPlayer threw: {e}");
return;
}
var summary = report.summary;
Debug.Log($"[PlayerBuild] {summary.result} — {summary.totalSize} bytes in {summary.totalTime}, " +
$"{summary.totalErrors} error(s), {summary.totalWarnings} warning(s)");
if (summary.result != BuildResult.Succeeded)
{
foreach (var step in report.steps)
{
foreach (var msg in step.messages.Where(m => m.type == LogType.Error || m.type == LogType.Exception))
{
Debug.LogError($"[PlayerBuild] {step.name}: {msg.content}");
}
}
Fail($"Build did not succeed: {summary.result}");
return;
}
Debug.Log("[PlayerBuild] ok");
}
static void Fail(string message)
{
Debug.LogError($"[PlayerBuild] {message}");
EditorApplication.Exit(1);
}
/// <summary>Reads "-name value" out of the command line Unity was launched with.</summary>
static string ArgValue(string name)
{
var args = Environment.GetCommandLineArgs();
for (var i = 0; i < args.Length - 1; i++)
{
if (string.Equals(args[i], name, StringComparison.Ordinal))
{
return args[i + 1];
}
}
return null;
}
}
}