LightProbeManager Class

public sealed class LightProbeManager : WorldGroupingListener

[BETA ONLY]A special World Grouping Listener that can be added to World Grouping's that use Light Probes in order force Tetrahedralization of Light Probes whenever Cells are added or removed from the Groupings.

In Unity 2023.2 and greater, this Manager also control the repositioning of Light Probes to enable Light Probe support on Floating Origin based Worlds and/or Endless Worlds.

Each World Grouping that contains Light Probes should use a seperate LightProbeManager, however note that in general, only a single World Grouping should contain Light Probes. Using multiple Groupings with Light Probes will be less efficient, as tetrahedralization cannot be timed as precicely and may be called more often then strictly needed.

Properties

Name Type Description
IgnoreLODTransitions bool

Overriden to return false.

YieldBehaviorAfterMethodExecution ListenerYieldBehavior

Overriden to return ListenerYieldBehavior.YieldOrContinue

Methods

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

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

This method is used to detect the addition of Asset Chunks that were baked with light probe data. We use OnBeforeCellsInBatchActivated because this method is called before the Asset Chunks are added to the Hierarchy Organizer, which means the Asset Chunks should still be associated with their original scene, assuming Keep Scenes Intact has been configured correctly.

Parameters

Name Type Description
cells ReadOnlyList<WorldCell>

The batch of cells which have been activated.

batchNumber int

The batch number. Will be between 1 and totalBatchesToExpect. You can use the batch number to determine if the batch of cells is the first or last, and perform specific logic based on that. For instance, you may want to perform a method call that should only be performed after all cells have been processed by your World Grouping Listener.

totalBatchesToExpect int

The total batches to expect. Once the batchNumber is equal to this value, you know that you are on the final batch of cells. This method will not be called again after that, except for a new World Update.

cellsArePartOfLODTransition bool

Whether the current batch of cells are being activated as part of an LOD transition.

immediateMode bool

Whether the method is being called in immediate mode. Immediate mode simply means that the method is not being used as a coroutine. All yield statements are ignored in this mode and the entire code block will execute in a single frame. This mode is used only when the Component Manager in the scene has been Initialized in a non gradual manner, either via its "Initialize on Awake" method being enabled, or you (the user) calling Initialize in the Awake method of some script. In these instances, the World and its World Groupings are initialized and loaded within two frames (Awake and Start) so that the World Chunks appear before the first Update is called.

Typically you will not need to do any special code changes for immediate mode, however in case you do need to, you can query this value to determine if immediate mode is being used.

Returns

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


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

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

This method is to detect the removal of Asset Chunks containing Light Probe Groups. When these Asset Chunks are being removed, information about the chunk is tracked in order to match it to the appropriate scene when the scene is unloaded. This allows us to remove the light probes object before the scene is completely unloaded, which solves a bug that is currently in Unity.

Parameters

Name Type Description
cells ReadOnlyList<WorldCell>

The batch of cells which have been deactivated.

batchNumber int

The batch number. Will be between 1 and totalBatchesToExpect. You can use the batch number to determine if the batch of cells is the first or last, and perform specific logic based on that. For instance, you may want to perform a method call that should only be performed after all cells have been processed by your World Grouping Listener.

totalBatchesToExpect int

The total batches to expect. Once the batchNumber is equal to this value, you know that you are on the final batch of cells. This method will not be called again after that, except for a new World Update.

cellsArePartOfLODTransition bool

Whether the current batch of cells are being deactivated as part of an LOD transition.

Returns

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