stop the Yarn setup menu from overwriting a real scene

Fixes "Can't start dialogue: no Yarn Project has been configured."

Cause, and it was mine. Phase 3.7 said "retarget YarnDemoSetup.cs or retire it";
I retargeted it. But that menu does not modify a scene — it builds one from
scratch and calls SaveScene over its target. Pointing it at
SC101_ConferenceHall.unity armed it at the real level, and running it replaced
the scene with a bare Yarn demo: ten of fourteen roots gone, including the
player, the lighting and the navmesh. The leftover Dialogue System prefab
instance it left behind had no yarnProject override, auto-started, and produced
the error.

The scene was committed, so nothing was lost; it is restored from HEAD at 14
roots with its sun reference intact.

The menu now targets Assets/Scenes/Dev/YarnSandbox.unity and refuses to run if
its target is not under Scenes/Dev, via ScenePaths.IsDisposable. It is renamed
to "Set Up Yarn Sandbox Scene" so the menu says what it does. The other three
setup menus open and modify their target rather than regenerating it, so they
were never affected and are unchanged.

The test suite could not have caught this, because it asserted only that a
DialogueRunner existed. TheDialogueRunner_HasItsYarnProject now asserts there is
exactly one runner across the loaded scenes and that its project is set and
compiled — which reproduces the failure exactly when the scene is broken.

Also here: four UI prefabs pick up m_EditorClassIdentifier changes from
Assembly-CSharp to NightclubArcadia.Game, written by Unity after the assembly
split in the previous commit. Expected and correct.

EditMode 42/42, PlayMode 6/6, YarnCheck 9 files / 35 nodes.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
2026-08-25 21:14:13 +02:00
co-authored by Claude Opus 5
parent ad598143f8
commit 46160d86dc
8 changed files with 243 additions and 170 deletions
@@ -1,4 +1,5 @@
using System.Collections;
using System.Linq;
using NUnit.Framework;
using NightclubArcadia.Cinematics;
using Unity.Cinemachine;
@@ -73,6 +74,31 @@ namespace NightclubArcadia.PlayMode.Tests
"No DialogueRunner in any loaded scene");
}
/// <summary>
/// Regression: "Can't start dialogue: no Yarn Project has been configured."
///
/// Asserting the runner merely exists is not enough — it auto-starts on Start(),
/// and a runner with no project throws that at load with nothing else wrong.
/// The project is a serialized asset reference supplied by a prefab override, so
/// it breaks silently if the override is ever dropped.
/// </summary>
[Test]
public void TheDialogueRunner_HasItsYarnProject()
{
var runners = Object.FindObjectsByType<DialogueRunner>(
FindObjectsInactive.Include, FindObjectsSortMode.None);
Assert.AreEqual(1, runners.Length,
"Expected exactly one DialogueRunner across the loaded scenes, found " +
string.Join(", ", runners.Select(r => $"'{r.name}' in {r.gameObject.scene.name}")));
var runner = runners[0];
Assert.IsNotNull(runner.YarnProject,
$"'{runner.name}' in scene '{runner.gameObject.scene.name}' has no Yarn Project. " +
"It auto-starts, so this is the 'no Yarn Project has been configured' error.");
Assert.IsNotEmpty(runner.YarnProject.NodeNames, "The Yarn Project compiled no nodes");
}
[Test]
public void EveryNpc_ResolvedItsDialogueRunner()
{