ChunkDisplayTool
A class in Root.Township, ATT.FeatureTestGymnasium.
Debug tool for the feature test gymnasium that draws coloured quads over chunk bounds: none, all chunks or loaded ones only. Singleton behaviour.
- Listed in ATT, Features and other game namespaces
- Inherits or implements
SingletonBehaviour<ChunkDisplayTool> - Derived types
ChunkDisplayTool
Constructors
| Member | What it is |
|---|---|
ChunkDisplayTool() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private LocationChunk[] allSceneChunks | Backing field for AllSceneChunks. |
private readonly Dictionary<int, GameObject> cachedChunkDisplays | Quad object per chunk, keyed by chunk hash code. |
private Renderer chunkDisplayPrefab | Quad prefab to spawn per chunk. |
private GymnasiumVisualChunkDisplayMode defaultMode | Mode set on enable. |
private int displayOpacity | Alpha (0 to 255) for the quad colours. |
private readonly HashSet<int> loadedChunks | Hash codes of chunks that have fully loaded. Never removed on unload. |
private static readonly Quaternion QuadRotation | Rotation that lays the quad flat. |
Properties
| Member | What it is |
|---|---|
GymnasiumVisualChunkDisplayMode CurrentMode { get; private set; } | The current display mode. Set to the default on enable, but not applied until AdvanceMode. |
2 private and internal properties
| Member | What it is |
|---|---|
private LocationChunk[] AllSceneChunks { get; } | Every LocationChunk in the scene, found once and cached. |
private GymnasiumVisualChunkDisplayMode NextMode { get; } | The mode after the current one, wrapping round. |
Methods
| Member | What it is |
|---|---|
void AdvanceMode() | Switches to the next display mode and applies it. |
10 private and internal methods
| Member | What it is |
|---|---|
private void ApplyMode(GymnasiumVisualChunkDisplayMode mode) | Shows or hides chunk quads for the given mode. |
private GameObject CreateChunkQuad(Bounds bounds) | Spawns a quad the size of the chunk bounds with a random bright colour. |
private void DisplayAll() | Shows a quad for every chunk in the scene. |
private void DisplayChunkVisual(Chunk chunk) | Shows the chunk's quad, creating it the first time. |
private void DisplayLoadedOnly() | Hides all quads, then shows those for chunks that have loaded. |
private void DisplayNone() | Hides every quad. |
private void OnChunkLoaded(Chunk chunk) | Records the chunk as loaded and shows it in loaded-only mode. |
private void OnChunkUnLoaded(Chunk chunk) | Hides the chunk's quad in loaded-only mode. It stays in loadedChunks. |
private void OnDisable() | Unhooks from every chunk's load events. |
private void OnEnable() | Sets the default mode and hooks every chunk's load and unload events. |