using UnityEditor; using UnityEngine; /// /// Reminds the user to run the one-shot prefab/scene wiring menu after scripts /// compile. Runtime play works without it via UILayerBootstrap. /// [InitializeOnLoad] static class UILayerSetupAutoRun { const string PrefKey = "NightclubArcadia.UILayerSetup.Reminded"; const string MarkerPrefab = "Assets/Prefabs/UI/PlayerMenuCanvas.prefab"; static UILayerSetupAutoRun() { EditorApplication.delayCall += RemindIfNeeded; } static void RemindIfNeeded() { if (EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isCompiling) { return; } if (AssetDatabase.LoadAssetAtPath(MarkerPrefab) != null) { return; } if (EditorPrefs.GetBool(PrefKey, false)) { return; } EditorPrefs.SetBool(PrefKey, true); Debug.Log( "[UILayer] Prefabs not built yet. Play Mode works via UILayerBootstrap. " + "To author prefabs into the scene, run Tools → Nightclub Arcadia → Set Up UI Layer."); } [MenuItem("Tools/Nightclub Arcadia/Reset UI Layer Auto-Setup Flag")] static void ResetFlag() { EditorPrefs.DeleteKey(PrefKey); Debug.Log("[UILayer] Reminder flag cleared."); } }