GridLODDetails Class

public sealed class GridLODDetails: IIdentifiable

Stores information on a Streamable Grid LOD Group. You can modify this information via the Streamable Grid's inspector.

Properties

Name Type Description
ChunkType_PreInitSafe ChunkType

Gets the Chunk Type used by this LOD Group (type of Asset Chunks that are loaded via Chunk Streamers).

ChunksUsePositionalData bool

Gets a value indicating if the LOD Chunks uses positional data. If the Chunk Type is None, this always returns false. If it is Unity_Terrain, it always returns true. Otherwise, it returns the value of 'Uses Positional Data' set in the insepctor of the LOD Group on the Streamable Grid.

In order to avoid some calculation each time this is called, this value is set during Streamable Grid initialization, and thus should not be used before it has been initialized.

DoAllCellsUseSameNumberOfChunks bool

Gets a value indicating whether all Streamable Grid cells associated with this LOD Group use the same number of chunks. You can only access this property after the Streamable Grid has been initialized.

GroupName_PreInitSafe string

Gets the Group Name asigned to this LOD Group in the Streamable Grid inspector. Note, if the Group Name of the LOD Group has been manually changed either pre or post World initialization, it will not be reflected here.

As such, if you are trying to retrieve the actual Group Name in use by the LOD Group, it is safer to use the World's GetLODGroupName method instead.

ID int

An ID that identifies this LOD Group. It is assigned automatically at the time the LOD Group is created and will never change, regardless of whether you change the order of the LOD Group on the Streamable Grid.

Is is also gauranteed to be unique (in relation to other LOD Groups on the same Streamable Grid). You can use this ID to retrieve the LOD Details instead of using the LOD Number, which is more reliable as the LOD Number may change as you re-order LOD Groups and/or add/remove LOD Groups.

Note, if you remove an LOD Group and re-add it, the ID of the LOD Group will likely change!

LevelOfDetail int

Gets which level of detail these details belongs to on the Streamable Grid. You can find this number in the LOD Groups tab of the Streamable Grid, under the "Add LOD Group" button. It is the number shown on the tabs that allow you to select each LOD Group.

NamingConvention INamingConvention

Gets the naming convention used by this LOD Group.

RootState RootState

Gets the state of the root game objects in Scene Based Asset Chunks for this LOD Group.

At runtime this is just used to ensure the actual state of root objects in Scene Based Asset Chunks match what you have specified. If the LOD Group does not use Scene Based Asset Chunks, this setting is ignored.

StreamableGrid StreamableGrid

Gets the Streamable Grid this LOD Group is a part of.

StreamableGridCellWithChunkSetToUse_PreInitSafe Cell

When UseSingleChunkSetForAllCells_PreInitSafe return true, this returns the cell on the Streamable Grid whose chunks will be used for all World Cells on this LOD. All included Chunk Streamers can make use of this functionality, however note that if you create a custom Chunk Streamer, you will need to add the necessary code to make this work, or else disable this option in the inspector of your Streamable Grid.

UseSingleChunkSetForAllCells_PreInitSafe

Gets a value indicating whether this LOD is using a single chunk set (from the Streamable Grid Cell indicated by StreamableGridCellWithObjectSetToUse) for all World Cells. All included Chunk Streamers can make use of this functionality, however note that if you create a custom Chunk Streamer, you will need to add the necessary code to make this work, or lease disable this option in the inspector of your Streamable Grid.

UsesTerrain bool

Gets a value indicating whether the LOD Group uses Unity Terrain.

UtilizesMultiChunking_PreInitSafe bool

Gets a value indicating whether this LOD Group utilizes multiple chunks for its cells. If this is true, the naming convention you set for this Streamable Grid LOD Group must include the special %c characters in the Supplemental Chunk Format field. This format is used for Chunks 2+ in each cell's chunk set.

If you are trying to retrieve the number of chunks a particular cell has, you do not need to check this property first before calling the appropriate method.

VisualStateOfStoredAssetsWhenActive_PreInitSafe VisualState

Gets the stored visual state of the assets associated with this LOD, which is only applicable when using a Cell Visual Transition Controller. To determine this, imagine the assets were added to the scene and put into an active state (using SetActive(true) for game objects for instance), and then positioned according to the PositionOfChunks property of whatever World Cell they are associated with. If the objects would be visible after this, the stored state is Visible. Otherwise, it is Invisible.

Another way to think about it is to consider the Cell Visual Transition Controller you are using. It transitions objects from a visible state to an invisible state, or vice versa. Does the stored state of your assets match the state they would be in if your controller transitioned them to a visible state? If so, then the stored state is Visible. Otherwise it is Invisible.

Methods

GetCellChunksUsingArrayIndex(int)

public int GetCellChunksUsingArrayIndex(int flattenedStreamableGridIndex)

Gets the number of chunks used by a particular Streamable Grid Cell for this LOD Group, however uses the flattened index of the Streamable Grid Cell.

Parameters

Name Type Description
flattenedStreamableGridIndex long

The index of the cell whose number of chunks you wish to know. You may come by this value in two ways.

The first is by using the Streamable Grid's FlattenCellIndex function on a single Streamable Grid Cell (note that you cannot use FlattenCellIndexForSparseEnabledArray, as it returns values incompatible with this method).

The second is by iterating over the flattened indexes of all enabled cells via the Streamable Grid's FlattenedIndexesOfEnabledCells method, which returns an enumerable object that can be iterated over.

Returns

int
The number of chunks used by the cell.


GetCellChunksUsingEndlessGridCell(Cell)

public ReturnType GetCellChunksUsingEndlessGridCell(Cell endlessGridCell)

Gets the number of chunks used by a particular Endless Grid Cell for this LOD Group.

Parameters

Name Type Description
endlessGridCell Cell

The cell whose number of chunks you wish to know.

Returns

int
The number of chunks used by the cell.


GetCellChunksUsingStreamableGridCell(Cell)

public int GetCellChunksUsingStreamableGridCell(Cell streamableGridCell)

Gets the number of chunks used by a particular Streamable Grid Cell for this LOD Group.

Parameters

Name Type Description
streamableGridCell Cell

The cell whose number of chunks you wish to know.

Returns

int
The number of chunks used by the cell.


GetChunksArrayAsNativeArray(Allocator)

public NativeArray<int> GetChunksArrayAsNativeArray(Allocator allocationType)

Creates and returns a Native Array that represents the chunk values for each cell on the Streamable Grid in association with this LOD Group.

The only use case for this is if you need to do some processing involving the number of chunks and you have an incredibly large number of cells on the Streamable Grid.

Otherwise you should make use of the other "GetCellChunks..." methods instead.

Note that if all cells use the same number of chunks, the array will be of length 1 with the uniform value stored at index 0.

Parameters

Name Type Description
allocationType Allocator

The type of allocation to use for the Native Array.

Returns

NativeArray<int>
The native array. Will be of length 1 if all cells have the same number of chunks.


TryGetExtraData_PreInitSafe(string, out string)

public bool TryGetExtraData_PreInitSafe(string key, out string data)

Tries to get extra data stored on this LOD Group using a key string value.

This data must be configured in the Streamable Grid inspector, either in the global extra data for the Streamable Grid, or in the Extra Data section for the LOD. If you used one of the preset keys, make sure the key you pass into this method matches how this preset appears in the inspector exactly!

The method works by first trying to access the LOD Group specific extra data, and if that extra data contains a matching key, it returns the data from the LOD Group. If no matching key is found in the LOD Group's extra data, the method searches the Streamable Grid's global extra data for the key, and returns the data if found. If no key is found in either place, data is set to null and false is returned.

Parameters

Name Type Description
key string

The key used to access the extra data.

data string

If the method returns true, this will contain the extra data associated with the input key. If it returns false, this will be null.

Returns

bool
True if the extra data was successfully retrieved. False otherwise.