public class WorldCell
Represents a tangible cell on the World.
Each World Cell is always associated with a specific Cell on a Streamable Grid and
a Cell on an Endless Grid. For non endless/repeating Worlds,
these two Cell values will always match, but for endless Worlds (with one or more
endless Axis), these Cells may or may not match. As such, the primary
identificator of a World Cell is it's CellOnEndlessGrid, as this is gauranteed to
be unique across all loaded World Cells.
In 99% of cases, each World Cell will have one or more Asset Chunks stored in it,
which is typically determined by the Streamable Grid Cell and active LOD of the
World Cell. World Cell's can trade up or down in LODs, moving from using the Asset
Chunks of a lower quality LOD Group to a higher quality LOD Group, or vice
versa. When this happens, a new World Cell is used to store the new LODs Asset Chunks,
and internally this new World Cell
replaces the old World Cell that used the previous LODs chunks.
If the World Cell's active LOD is associated with an LOD Group that uses Unity Terrain,
the World Cell will actually be a
WorldCellWithTerrain
object, which allows it to store Unity Terrain and perform other operations required
for Terrain Neighboring to work.
Your primary interaction with World Cells will come in custom
Cell Visual Transition Controllers and
World Grouping Listeners, though there are
several other components that interact with them as well.
Name | Type | Description |
---|---|---|
AllChunkAssetsMatchExpectedLOD | bool |
Whether every chunk asset on this World Cell matches the expected assets for its current
active Level of Detail. This will be true in most cases.
One situation where it might be false is if using an Addressable Streamer and an asset
fails to download properly.
|
BaseCellThisCellResidesIn | Cell |
Gets the Endless Grid Cell from the Base Grouping that this World Cell resides within. Note that it's possible that this World Cell falls within multiple Base Grouping Cell's. The value returned here is the Cell in which the CellPosition of this World Cell falls within. |
BottomNeighbor | WorldCell |
Gets the World Cell that neighbors this WorldCell below (-Y Axis, only present for 3D Worlds). |
Bounds | BoundsDouble |
The bounds of the World Cell in the scene, which is calculated from the CellPosition
and dimensions of the cell (as set on the Streamable Grid).
|
CellOnEndlessGrid | Cell |
Gets the cell's index on the Endless Grid associated with the World Grouping this cell belongs to. |
CellOnStreamableGrid | Cell |
Gets the cell's index on the Streamable Grid associated with the World Grouping this cell belongs to. |
CellPosition | Vector3Double |
Gets the position of the cell in world space (note, this may be different than the position of the chunk, since the chunk can be offset from the cell). |
CellUsers | int |
Gets the number of users of this World Cell across all LODs. The World Cell upgrades to a higher quality LOD whenever a user is added for the higher quality LOD (where no user was present before). It downgrades when the user count for an LOD reaches 0 (and users for a lower quality LOD exists). When the total CellUsers count reaches 0, it is unloaded completely. |
ChunkManager | ChunkManager |
Gets the chunk manager resposible for managing this World Cell. |
ChunkStreamer | ChunkStreamer |
Gets the chunk streamer resposible for loading and removing/deactivating the Asset Chunks for this World Cell. |
DoesCellHaveMultipleChunks | bool |
Gets a value indicating whether the cell has multiple Asset Chunks. |
DoesCellHaveUsers | bool |
Gets a value indicating whether the World Cell currently has any users across all LODs. |
EastNeighbor | WorldCell |
Gets the World Cell that neighbors this WorldCell to the East (+X Axis). |
FlattenedStreamableGridIndex | long |
Gets the flattened index of the cell on the Streamable Grid it belongs to. The flattened
index is the CellOnStreamableGrid value flattened to
represent an index in a 1D array of size (StreamableGrid.Rows * StreamableGrid.Columns
* StreamableGrid.Layers).
|
Height | double |
Gets the height of the cell. |
Length | double |
Gets the length of the cell. |
LevelOfDetail | int |
Gets the active Level of Detail of the World Cell. |
NorthNeighbor | WorldCell |
Gets the World Cell that neighbors this WorldCell to the North (+Y for 2D XY Grids, or +Z otherwise). |
NumChunks | int |
Gets the number of Asset Chunks this World Cell has. |
PositionOfChunks | bool |
Gets the position that Asset Chunks should be placed at. You can position the chunks manually, or let them be automatically positioned by the World (by passing in No or Maybe for chunksPositionedCorrectlyAlready when calling AttachChunkToCell). |
SouthNeighbor | WorldCell |
Gets the World Cell that neighbors this WorldCell to the South (-Y for 2D XY Grids, or -Z otherwise). |
StreamableGrid | StreamableGrid |
Gets the Streamable Grid this cell was created from. |
TopNeighbor | WorldCell |
Gets the World Cell that neighbors this WorldCell above (+Y Axis, only present for 3D Worlds). |
WestNeighbor | WorldCell |
Gets the World Cell that neighbors this WorldCell to the West (-X axis). |
Width | double |
Gets the width of the cell. |
World | World |
Get the World this World Cell belongs to. |
WorldGroupingIndex | int |
Gets the index of the World Grouping that this cell belongs to. |
public void AttachChunkToCell(object chunk, ChunksPositioned chunksPositionedCorrectlyAlready, int chunkIndex)
Attaches an Asset Chunk to the cell. If creating a custom Chunk Streamer or Chunk
Manager class,
you should either let the World position the chunk correctly by
passing in 'No' for chunksPositionedCorrectlyAlready, or position the chunks manually
(or instantiate it
at the correct position) and pass in 'Yes'. If you are unsure whether it's positioned
correctly, you can pass in Maybe instead.
It's assumed that all chunks attached for a World Cell during a given operation will
have the same value for chunksPositionedCorrectlyAlready.
As such, only the value passed in for the last chunk will actually be used.
The chunks are not positioned immediately.
If you require them to be positioned immediately in whatever is calling this method,
you should position them manually and pass
in Yes for the chunksPositionedCorrectlyAlready value.
If you have some chunks that are positioned already and others that are not,
pass in Maybe to have the World evaluate all of the chunks.
Name | Type | Description |
---|---|---|
chunk | object |
The Asset Chunk to attach to the cell. While you can pass in any object, the object should match the Chunk Type you set on the LOD Group of your Streamable Grid. |
chunksPositionedCorrectlyAlready | ChunksPositioned |
Whether the Asset Chunks attached to the World Cell are already positioned correctly.
If 'No', the chunks will be moved to PositionOfChunks (at a later time) by the World.
|
chunkIndex | int |
The index of the chunk. 1 should be passed in if not using multi-chunking. Cannot be larger than NumChunks. |
public object DetachChunksFromCell(int chunkIndex)
Detaches the Asset Chunk at the specified index from the cell and returns it.
The object returned and no longer associated with the World Cell (i.e., the World
Cell no longer holds a reference to it).
Name | Type | Description |
---|---|---|
chunkIndex | int |
The index of the chunk to detatch (one based). If you are not using chunks (i.e., there is only 1 chunk), then pass in 1. Cannot be larger than NumChunks. |
object
The chunk that was detached from the World Cell.
object GetChunkBelongingToCell(int)
Gets the Asset Chunk at chunkIndex belonging to the cell. Unlike DetachChunksFromCell, this does not disassociate the chunk from the World Cell (i.e., the World Cell will still hold a reference to the chunk after this method is called).
Name | Type | Description |
---|---|---|
chunkIndex | int |
The index of the chunk you wish to get. If you are not using multi-chunking (i.e., there is only 1 chunk), then pass in 1. Cannot be larger than NumChunks. |
object
The chunk at chunkIndex.