Skip to content

Game.Debug.SceneFlowDebugUI

Assembly:
Assembly-CSharp.dll (common for Cities: Skylines 2 game code / mods)
Namespace: Game.Debug

Type: class

Base: System.Object

Summary:
A debug UI container that exposes scene-related information and quick debug actions to the in-game debug system. It provides a tab ("Scene Flow") that shows the current game mode, a foldout listing loaded scenes and each scene's root object count, a foldout with several "crash test" buttons (throws an exception or calls Unity's Utils.ForceCrash with various ForcedCrashCategory values), and utility buttons to refresh the debug UI and dismiss all error dialogs. The class is marked with DebugContainer so the debug system will pick it up via reflection.


Fields

  • None
    This class declares no instance or static fields.

Properties

  • None

Constructors

  • public SceneFlowDebugUI()
    This class relies on the compiler-generated default constructor (no explicit constructors defined).

Methods

  • private static List BuildSceneFlowDebugUI() This method is decorated with [DebugTab("Scene Flow", -10)] and is used by the debug system to build the "Scene Flow" tab contents. It constructs and returns a list of DebugUI.Widget instances which include:
  • A DebugUI.Value showing "Mode" that returns GameManager.instance.gameMode.
  • A "Crash tests" foldout containing buttons that:
    • Throw a test Exception.
    • Call Utils.ForceCrash with ForcedCrashCategory.{AccessViolation, Abort, FatalError, MonoAbort, PureVirtualFunction}.
  • A "Loaded Scenes + RootCount" foldout that iterates SceneManager.sceneCount and adds a DebugUI.Value for each loaded scene showing scene.name and returning scene.rootCount.
  • A "Refresh" button which calls DebugSystem.Rebuild(BuildSceneFlowDebugUI).
  • A "Dismiss all errors" button which calls ErrorDialogManager.DismissAllErrors().

Notes: - The method is private static but is discovered by the debug framework via its DebugTab attribute (reflection-based registration). - The crash-test buttons invoke Unity diagnostics (Utils.ForceCrash) which will forcibly crash the game process in different ways; these should be used with caution and only in controlled testing environments.

Usage Example

// The debug UI is registered automatically via the [DebugContainer] and [DebugTab] attributes.
// From code you can request the debug system to rebuild UI (the class itself contains a Refresh button that does this):
DebugSystem.Rebuild(() => {
    // Normally BuildSceneFlowDebugUI is private and discovered by attribute/reflection.
    // But you can trigger a rebuild to refresh all debug tabs:
    DebugSystem.Rebuild(null);
});

// To programmatically dismiss errors (same action as the provided button):
ErrorDialogManager.DismissAllErrors();

// WARNING: The crash test buttons call UnityEngine.Diagnostics.Utils.ForceCrash.
// Do NOT invoke these in production or without expecting the game to terminate.