Skip to content

Game.Debug.TestsDebugUI

Assembly: Assembly-CSharp
Namespace: Game.Debug

Type: public static class TestsDebugUI

Base: System.Object (static class)

Summary: Utility class that integrates test scenarios into the in-game debug UI. Marked with [DebugContainer], it exposes a debug tab "Test Scenarios" (via the private static method annotated with [DebugTab("Test Scenarios", -21)]) which enumerates scenarios defined by TestScenarioSystem.instance and presents them grouped by category as DebugUI.Foldout entries. Each scenario is shown as a DebugUI.Button that, when pressed, invokes TestScenarioSystem.RunScenario for that scenario. The tab is only built if GameManager.instance.configuration.qaDeveloperMode is enabled; otherwise the method returns null. This class contains no instance state and acts as a bridge between the test scenario system and the debug UI.


Fields

  • This class does not declare any fields. {{ The class is a static container for a debug UI builder and holds no private or public fields. It relies on singletons (GameManager, TestScenarioSystem) and local variables within the method. }}

Properties

  • This class does not declare any properties. {{ The class exposes no properties; its functionality is provided through a single static method discovered via the debug attribute. }}

Constructors

  • This class has no constructors. {{ Being a static class, there are no public or instance constructors to initialize. The debug system discovers the decorated method at runtime. }}

Methods

  • private static System.Collections.Generic.List<DebugUI.Widget> BuildTestScenariosDebugUI() {{ Description:
  • This method builds the "Test Scenarios" debug tab contents. It is decorated with [DebugTab("Test Scenarios", -21)] so the debug UI system will call it to obtain widgets for that tab. Behavior:
  • If GameManager.instance.configuration.qaDeveloperMode is false, the method returns null (the tab will not be shown).
  • Obtains the TestScenarioSystem singleton (TestScenarioSystem.instance).
  • Iterates over tss.scenarios (Dictionary).
  • Groups scenarios by their Scenario.category (a Category enum) into DebugUI.Foldout widgets (one foldout per category).
  • For each scenario, creates a DebugUI.Button with displayName = scenario key (string) and an action that calls tss.RunScenario(scenario.Key, CancellationToken.None).
  • Returns the list of top-level widgets (foldouts), which the debug UI renders.

Notes: - The method returns null when QA developer mode is disabled to hide the entire tab. - Buttons call RunScenario synchronously on the same thread (no CancellationToken other than CancellationToken.None is provided). - Scenario keys are used as display names and as identifiers passed to RunScenario; ensure the exact key strings match the entries in TestScenarioSystem. }}

Usage Example

// The debug UI system discovers and invokes BuildTestScenariosDebugUI automatically
// when QA developer mode is enabled. To run a scenario programmatically:

if (GameManager.instance.configuration.qaDeveloperMode)
{
    var tss = TestScenarioSystem.instance;
    // Replace "My Scenario Name" with the scenario key as stored in tss.scenarios
    tss.RunScenario("My Scenario Name", CancellationToken.None);
}

{{ YOUR_INFO: - To see the "Test Scenarios" tab in-game, enable QA developer mode in the game configuration (GameManager.instance.configuration.qaDeveloperMode = true). - The debug UI framework uses the [DebugContainer] and [DebugTab] attributes to discover and add tabs at runtime; you do not call BuildTestScenariosDebugUI directly. - If you add or rename scenarios in TestScenarioSystem, the debug tab reflects those changes automatically the next time the debug UI rebuilds. - If you need cancellation support for long-running scenarios, you'll need to modify the RunScenario calls to pass an appropriate CancellationToken sourced from user input or your own cancellation logic. }}