ChunkReuseJudge Class

public class ChunkReuseJudge : MonoBehaviour

A MonoBehaviour you can derive from to implement custom logic for determing whether chunks associated with a particular Streamable Grid Cell can be reused by a World Cell using a second Streamable Grid Cell (which might be the same or different than the first Streamable Grid Cell).

By default, the Streamable Assets Manager only reuses objects from one World Cell on another World Cell when the two World Cell's have matching Streamable Grid Cell indexes. In some cases however, such as when using the same game object for every Streamable Grid Cell on the World, you may want to utilize alternative logic (for instance in that example case, since all Streamable Grid Cells use the same objects, you could return true for every Compare test).

The instance of your ChunkReuseJudge in the scene must be linked to a Chunk Manager in order to be used. If no ChunkReuseJudge is provided, the default logic as described above will be used.

Please note that the judgement logic is only run for World Cells on the same World Grouping and LOD. World Cells on different LOD's or World Groupings will never reuse game objects between each other. In addition, the default Pooling Chunk Manager and any other classes derived from it do not utilize the Cell Object Reuse Judge in their pooling logic. You will need to create a Chunk Manager that does not derive from the Pooling class in order to make use of the reuse judge.

Delegates

JudgementDelegate(Cell, Cell)

public delegate bool JudgementDelegate(Cell cellThatHasChunks, Cell cellThatNeedsChunks)

A delegate which you need to use to implement the logic. The delegate construct is used in order to allow the logic to be used in a Job, which provides speedier performance. This is also why the arguments are the Streamable Grid Cell's associated with each World Cell, and not the World Cell's themselves.

The logic is queried internally by each World Grouping when it is transitioning or activating new cells. The objects from World Cells that have already been deactivated will provide the cellThatHasChunks input, and the World Cells to be activated will provide the cellThatNeedsChunks input.

Do note that only World Cells on the same World Grouping and LOD are queried. World Cells on different World Groupings or LOD's never reuse game objects between them.

Parameters

Name Type Description
cellThatHasChunks Cell

The Streamable Grid Cell index associated chunks that may be reusable.

cellThatNeedsChunks Cell

The Streamable Grid Cell index associated with the World Cell that needs chunks.

Returns

bool
Must return true if the objects associated with cellThatHasChunks should be reused by the World Cell associated with cellThatNeedsChunks. False otherwise.

Methods

GetJudgementLogic()

public abstract JudgementDelegate GetJudgementLogic()

Gets the custom logic for performing judgements between two Streamable Grid Cell's in order to determine reuse eligibility.

Returns

JudgementDelegate
The logic of the judge. This must be in the form of JudgementDelegate.