Game.Rendering.ManagedBatchSystemDebugger
Assembly: Assembly-CSharp
Namespace: Game.Rendering
Type: class
Base: UnityEngine.MonoBehaviour
Summary:
A small MonoBehaviour helper used for debugging ManagedBatchSystem state at runtime. Exposes a section name constant and provides access to the associated ManagedBatchSystem instance and its material map (a read-only dictionary mapping ManagedBatchSystem.MaterialKey to UnityEngine.Material). Typically attached to a GameObject for in-game inspection or editor debugging of batching/materials.
Fields
public const string kSectionName
Constant string with the value "======System======" intended for use when emitting or grouping debug output related to the managed batch system.
Properties
-
public ManagedBatchSystem managedBatchSystem { get; set; }
Reference to the ManagedBatchSystem being inspected. This is a standard read/write property — assign the system to inspect (for example by wiring it up from code), or leave null if none is attached. -
public IReadOnlyDictionary<ManagedBatchSystem.MaterialKey, Material> materials { get; }
Read-only convenience property that returns managedBatchSystem?.materials. Returns the material dictionary exposed by the ManagedBatchSystem (or null if managedBatchSystem is null). The dictionary maps ManagedBatchSystem.MaterialKey to UnityEngine.Material and can be used to enumerate or inspect materials used by the batching system.
Constructors
public ManagedBatchSystemDebugger()
Default MonoBehaviour constructor. In Unity, instances are usually created via AddComponent rather than direct construction; initialization should be done in Awake/Start if needed.
Methods
- None declared in this class.
This class does not override MonoBehaviour lifecycle methods (Awake, Start, Update, etc.). It purely exposes properties for debugging/inspection.
Usage Example
// Add the debugger to a GameObject and assign the system you want to inspect.
var debugger = gameObject.AddComponent<Game.Rendering.ManagedBatchSystemDebugger>();
debugger.managedBatchSystem = someManagedBatchSystemInstance;
// Safely enumerate materials (check for null)
var mats = debugger.materials;
if (mats != null)
{
foreach (var kv in mats)
{
var key = kv.Key; // ManagedBatchSystem.MaterialKey
var material = kv.Value; // UnityEngine.Material
Debug.Log($"{Game.Rendering.ManagedBatchSystemDebugger.kSectionName} Key={key} Material={material.name}");
}
}
else
{
Debug.Log("ManagedBatchSystem not assigned or has no materials.");
}