WorldCellVisualizer Class

public sealed class WorldCellVisualizer : WorldGroupingListener

A special World Grouping Listener that can be added to a World Grouping in order to visualize the World Cell's bounds in the Scene and Game view. This class has been setup to be usable with multiple World Groupings and Worlds, however if you want each World Grouping to use a different color for the visualization, you will need to create separate visualizers for each.

Properties

Name Type Description
IgnoreLODTransitions bool

Overriden to return false, because the visualizer tracks World Cells and thus needs to know when lod transitions occur (because the actual WorldCell objects changes when this happens).

YieldBehaviorAfterMethodExecution bool

Overriden to return false.

Methods

OnAfterAllCellsActivated(ReadOnlyList<WorldCell>, int, int, bool, bool)

public sealed override IEnumerator<YieldInstruction> OnAfterAllCellsActivated(ReadOnlyList<WorldCell> cells, int batchNumber, int totalBatchesToExpect, bool cellsArePartOfLODTransition, bool immediateMode)

Overriden so that the visualizer receives notification after all cells are activated. This is used to add these cells to the tracked collection so that the visualizer can visualize the cells. This method is used because it functions better with the duplication world reset strategy.

Parameters

Name Type Description
cells ReadOnlyList<WorldCell>

The batch of cells that have been activated.

batchNumber int

The number of the batch (1 out of 19, for instance). The visualizer does not use this information.

totalBatchesToExpect int

The total number of batches in the current World update, i.e., the total number of times this method will be called for the current World Update. The visualizer does not use this information.

cellsArePartOfLODTransition bool

Whether the cells are part of a LOD transition.

immediateMode bool

Whether this method should execute in a single frame.

Returns

IEnumerator<YieldInstruction>
An IEnumerator<YieldInstruction> that can be iterated over or used as a coroutine. See the YieldInstruction page for more info.


OnBeforeAnyCellsDeactivated(ReadOnlyList<WorldCell>, int, int, bool)

public sealed override IEnumerator<YieldInstruction> OnBeforeAnyCellsDeactivated(ReadOnlyList<WorldCell> cells, int batchNumber, int totalBatchesToExpect, bool cellsArePartOfLODTransition)

Overriden so that the visualizer receives notification before any cells have been deactivated. This is used to remove these cells from the tracked collection. This method is used because it functions better with the duplication world reset strategy.

Parameters

Name Type Description
cells ReadOnlyList<WorldCell>

The batch of cells that will be deactivated.

batchNumber int

The number of the batch (1 out of 19, for instance).

totalBatchesToExpect int

The total number of batches in the current World update, i.e., the total number of times this method will be called for the current World Update. The visualizer does not use this information.

cellsArePartOfLODTransition bool

Whether the cells are part of a LOD transition. Will always be false since the visualizer ignores LOD transitions.

Returns

IEnumerator<YieldInstruction>
An IEnumerator<YieldInstruction> that can be iterated over or used as a coroutine. See the YieldInstruction page for more info.


OnBeforeGroupingUpdated(World, int, bool)

public sealed override IEnumerator<YieldInstruction> OnBeforeGroupingUpdated(World world, int groupingIndex, bool immediateMode)

Called before a grouping is updated to perform prep work before cells are added/removed

Parameters

Name Type Description
world World

The World whose grouping is about to be updated.

groupingIndex int

The index of the grouping that is about to be updated.

immediateMode bool

Whether the method is being run in immediate mode.

Returns

IEnumerator<YieldInstruction>
An IEnumerator<YieldInstruction> that can be iterated over or used as a coroutine. See the YieldInstruction page for more info.