Files
nightclub-arcadia/NightclubArcadia/Assets/Editor/LegacySceneSetup.cs
T
lennartandClaude Opus 5 4f48d258b5 disable the pre-split scene builders instead of retargeting them
Fixes the "no Yarn Project has been configured" error coming back after running
the setup menus.

Last commit fixed the wrong layer. Retargeting YarnDemoSetup at a sandbox
stopped it destroying the level, but left the deeper problem: all of these
builders assume the single-scene layout, and after the split there is no target
path that makes them correct.

Two failures, both observed rather than reasoned about. Running the Yarn setup
left a generated scene open whose DialogueRunner had no project and auto-started
— that is the error the user kept seeing, coming from Dev/YarnSandbox.unity, not
from Systems. And retargeting the other three at Systems made PlayerControlSetup
pull navigation in with it; the baked NavMeshData is embedded rather than an
asset, so Systems.unity silently turned binary, 61KB text to 109KB binary. That
is trap 1 recurring on a scene that had just been fixed.

So the three scene builders now return early through LegacySceneSetup.Blocked,
with a message saying what they would have done and what to do instead. They are
not deleted: UILayerSetup alone is 818 lines that still record how the UI layer
is wired, and that record matters until prefabs replace it in Phase 5.

Set Up Skill System keeps its useful half. It regenerates the SkillDefinition
assets from JSON, which touches no scene; only the WireWorkingLevelScene call is
dropped, because those objects already exist in Systems.unity. Set Up Candidate
System was always asset-only and is untouched.

While diagnosing, YarnDemoSetup's own bug was found and fixed even though the
menu is now blocked: it set yarnProject through a SerializedObject on a prefab
instance without recording the override, so the assignment was dropped on save.
It now records the modification and refuses to save a scene whose runner has no
project.

Verified by running all five menus headlessly: the two asset generators run and
produce no diff, the three builders refuse, and no scene or asset changes.
Systems.unity restored to text, the level scene intact at 5 roots.

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

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-25 21:24:24 +02:00

49 lines
2.5 KiB
C#

using UnityEditor;
using UnityEngine;
namespace NightclubArcadia.EditorTools
{
/// <summary>
/// Gate for the one-shot scene builders under Assets/Editor.
///
/// Those menus were written when the whole game lived in a single scene. They find
/// or create the dialogue system, the UI canvases, the player and the camera rig,
/// and save the result into one scene. After the split into Bootstrap / Systems /
/// Level, that assumption is false, and running them does damage rather than work:
///
/// - Pointed at a level, they rebuild systems content that already exists in
/// Systems.unity, leaving duplicate UIStateControllers and dialogue runners.
/// - Pointed at Systems, PlayerControlSetup drags navigation in with it. The
/// baked NavMeshData is embedded rather than an asset, and NavMeshData prefers
/// binary serialization, so the whole scene silently turns binary — the exact
/// problem that took a bisection to find the first time (CLAUDE.md trap 1).
///
/// Both were observed, not theorised. So the builders are blocked rather than
/// retargeted, and deliberately not deleted: UILayerSetup alone is 818 lines that
/// still record how the UI layer is wired, and that record is worth keeping until
/// the prefabs replace it (docs/restructure-plan.md Phase 5).
///
/// Asset generators are unaffected. Regenerating SkillDefinitions or the candidate
/// registry from JSON touches no scene and stays available.
/// </summary>
public static class LegacySceneSetup
{
/// <summary>
/// Call at the top of any menu that builds scene content. Returns true if the
/// caller should stop, which is currently always.
/// </summary>
public static bool Blocked(string menuName, string whatItWouldDo)
{
Debug.LogError(
$"'{menuName}' is disabled.\n\n" +
$"It was written for the single-scene layout and would {whatItWouldDo}. " +
"The game is now split across Bootstrap, Systems and a level scene, and the " +
"objects it builds already exist in Assets/Scenes/Systems/Systems.unity.\n\n" +
"To run the game: open Assets/Scenes/Bootstrap.unity and press Play.\n" +
"To verify it comes up: make test-play\n" +
"Rewriting these for the split is docs/restructure-plan.md Phase 5.");
return true;
}
}
}