Skip to content

Game.Debug.UIDebugUI

Assembly:
Assembly-CSharp (game assembly)

Namespace:
Game.Debug

Type:
Class

Base:
System.Object

Summary:
Debug container class that builds the "UI" debug tab for inspecting the game's UI manager (UIManager) state. It enumerates UISystems and their UIViews, exposes counts for static/dynamic user images, provides actions (e.g., clear cached images, refresh debug view), and — when enabled — shows UI memory metrics using UnityPlugin. The class is discovered by the debug system via the [DebugContainer] attribute and exposes a tab via the [DebugTab("UI", -965)] attribute on its builder method.


Fields

  • None
    This class declares no explicit fields. All functionality is provided via the single private static builder method.

Properties

  • None
    No properties are declared on this class.

Constructors

  • public UIDebugUI()
    The default public parameterless constructor is implicit (no explicit constructor defined in source).

Methods

  • private static System.Collections.Generic.List<DebugUI.Widget> BuildUIBindingsDebugUI()
    This is the single method in the class and is annotated with [DebugTab("UI", -965)]. It is used by the debug system to produce the list of widgets that will be shown in the "UI" debug tab.

Detailed behavior: - Creates a top-level foldout "UI Manager". - Iterates through UIManager.UISystems and for each UISystem: - Creates a foldout labeled "UISystem #". - Adds values showing: - Static user image count (uiSystem.userImagesManager.staticUserImageCount). - Dynamic user image count (uiSystem.userImagesManager.dynamicUserImageCount). - Adds a button "Clear cached unused images" that calls uiSystem.ClearCachedUnusedImages(). - Iterates through uiSystem.UIViews and adds a container per UIView with: - A value showing "UIView #" with enabled state. - A value showing the UIView URL. - If the UISystem.resourceHandler is a DefaultResourceHandler and it has HostLocationsMap entries: - Adds a foldout "coui Hosts" listing each host key and its associated (path, port) entries. - If DefaultResourceHandler.DatabaseHostLocationsMap has entries: - Adds a foldout "assetdb Hosts" listing each host key and its associated (Uri, port) entries. - Builds a top-level list that includes: - A "Refresh" button that calls DebugSystem.Rebuild(BuildUIBindingsDebugUI) to rebuild the debug UI. - The "UI Manager" foldout built above. - If UIManager.instance.enableMemoryTracking is true: - Inserts a "UI Memory" foldout with values retrieved from UnityPlugin: - Allocated memory (FormatUtils.FormatBytes(UnityPlugin.Instance.GetAllocatedMemory())) - Time spent in allocations (ns) - Allocation count - Total allocations - Adds a "Mem tags" foldout that iterates MemTagsType values and, for each tag, displays: - Allocated bytes for the tag - Current counts for the tag - Totals for the tag - This "UI Memory" foldout is inserted near the top of the returned widget list.

Notes: - The returned List is used by the debug UI system; widgets include DebugUI.Foldout, DebugUI.Value, DebugUI.Button, and DebugUI.Container. - The method captures local loop variables carefully (using closures) to produce stable getters for values and avoid common closure pitfalls. - The method assumes presence of game types: UIManager, UIView, DefaultResourceHandler, UnityPlugin, FormatUtils, DebugSystem, DebugUI, MemTagsType, etc.

Usage Example

// The debug system discovers this class via [DebugContainer] and uses the method
// annotated with [DebugTab("UI", -965)] to populate the "UI" tab automatically.
// The class itself is minimal; the important part is the builder method:

[DebugContainer]
public class UIDebugUI
{
    [DebugTab("UI", -965)]
    private static List<DebugUI.Widget> BuildUIBindingsDebugUI()
    {
        // build and return the list of debug widgets (see docs above)
    }
}

// The provided UI already includes a "Refresh" button which calls:
DebugSystem.Rebuild(BuildUIBindingsDebugUI);

// When memory tracking is enabled (UIManager.instance.enableMemoryTracking),
// the debug UI shows memory statistics obtained via UnityPlugin.Instance.

Additional notes: - Intended for modding/debugging only — do not rely on these internals for production game logic or mods that must be compatible across major game updates. - The builder uses game internal types; ensure your mod references the same game assembly versions to avoid compatibility issues.