World Class

public sealed class World : MonoBehaviour, IIdentifiable

Represents a World, which combines one or more Streamable Grids together to form a complex game world. Whereas Streamable Grids are simply data containers, Worlds have position within the scene and are made up of Asset Chunks belonging to World Cells (which directly correspond to the Streamable Grid Cells on Streamable Grids). The World's position can either be fixed or be based on a floating origin system. On a Fixed Position based World, each World Cell and its Asset Chunks has a position that will never change through the lifetime of the game.

Floating Origin based Worlds use a fixed point in space as the Origin Point, but the Origin Cell can be changed (either explicitly or automatically as a result of the player moving a certain distance from the origin point), which effectively shifts the World Cells and Asset Chunks loaded by the World in an attempt to keep them close to the Origin Point.

Worlds can either be endless on one or more Axes or non endless. When an Axis is endless, the world repeats itself on that axis over and over again endlessly, which simulates a "spherical" World.

A World does not typically decide what should be loaded on its own (the exception is Auto-Loaded World Regions configured in the inspector). Instead, it receives commands to add and remove users for World Cells from external sources (such as Active Grids). It processes these add/remove user requests, cancelling out competing requests (i.e., an add and remove requests comes in for the same World Cell) and tallying the number of users for each LOD of a World Cell. It then loads, unloads, or transitions World Cells from one LOD to another based on those requests (for example, if remove requests come in for a World Cell and after processing them, the World Cell does not have any users for any LODs, the World Cell is unloaded).

The World operations within Update Cycles. After processing add/remove requests, if any changes to the makeup of World Cells is required, it initiates a World Update. While a World Update is in progress, any incoming add/remove requests are queued and only processed after the current World Update has finished.

Worlds do not load or unload the Asset Chunks associated with World Cells. They delegate this duty to Chunk Managers and Chunk Streamers, which manage the lifetime of Asset Chunks and load/unload chunks into/out of the scene respectively.

A World should only be disabled (or its game object disabled) if it is being used as a prototype to create Worlds at runtime via the Component Manager. Do not disable a World with the intention of enabling/using it at a later time, as this will not work properly. Instead, you should create the World via the Component Manager, and destroy it when it is no longer needed.

Alternatively, you can modify the World's World Sleep Mode setting to allow the World to sleep under certain conditions, such as when it has no loaded World Cells.

Methods that begin with "PreInitialize" in their name can only be used before the World has been initialized. Methods that end with "PreInitSafe" in their name are safe to use before or after the World has been intialized. Methods without either of these words can only be used after the World has been initialized.

For properties, we have indiciated in the property descriptions those that are safe to use both before and/or after the World has been initialized. All other properties are only safe to access after the World is initialized.

Fields

Name Type Default Value Description
CURRENT_EDITOR_VERSION int

Current version of the the World for use in the editor.

PERSISTENT_DATA_VERSION int

Current version of the world's persistent data.

Properties

Name Type Description
ActiveGridReCenteringAllowed bool

Gets a value indicating the 'Allow Active Grid Re-Centering' option is enabled in the inspector.

Pre Init Safe

AreColumnsEndless bool

Gets a value indicating whether the World's columns repeat to form an endless looping axis.

Pre Init Safe

AreLayersEndless bool

Gets a value indicating whether the World's settings have ben configured to use Endless Layers. Note that if the World's Predominant Axes Type is not 3D, the Layers will not be endless!

Pre Init Safe

AreRowsEndless bool

Gets a value indicating whether the World's rows repeat to form an endless looping axis.

Pre Init Safe

ChunkManager ChunkManager

Gets the chunk manager assigned to this World's Default Chunk Manager field (if any). Remember that this manager may be overriden on a per World Grouping basis or per LOD basis.

Pre Init Safe

ChunkStreamer ChunkStreamer

Gets the ChunkStreamer assigned to this World's Default Chunk Streamer field (if any). Remember that this manager may be overriden on a per World Grouping basis or per LOD basis.

Pre Init Safe

CreatedAtRuntime bool

Gets a value indicating whether the World was created at runtime. If false, it means the World was added in the inspector by the dev (not as a prototype).

EnabledZoneGroupings

Gets the number of enabled Zone Groupings. A Zone Grouping is Enabled if a Streamable Grid has been assigned to the Zone Grouping Grid field on each Zone (via the World inspector), and if the Zone it is a part of is enabled.

EndingColumn int

The Ending Column of this World in reference to its World Grid. This is basically the largest column that any zone is in plus East Gap Cells.

EndingColumn_ZeroBased int

The Ending Column of this World in reference to its World Grid. This is basically the largest column that any zone is in plus East Gap Cells.

EndingLayer int

The Ending Layer of this World in reference to its World Grid. This is basically the largest layer that any zone is in plus Top Gap Cells.

EndingLayer_ZeroBased int

The Ending Layer of this World in reference to its World Grid. This is basically the largest layer that any zone is in plus Top Gap Cells.

EndingRow int

The Ending Row of this World in reference to its World Grid. This is basically the largest row that any zone is in plus North Gap Cells.

EndingRow_ZeroBased int

The Ending Row of this World in reference to its World Grid. This is basically the largest row that any zone is in plus North Gap Cells.

HierarchyOrganizer HierarchyOrganizer

Gets the Hierarchy Organizer associated with the world, as assigned in the inspector.

Pre Init Safe

ID int

Gets the unique ID of the World.

Pre Init Safe

IDOfPrototypeConstructedFrom int

Returns the Prototype this runtime created World was constructed from. If the world is an inspector created World rather than a Runtime created one, this will return int.MinValue.

InitialOriginCell Cell

The initial Origin Cell (as set in the inspector of the World) of this World (in reference to the Base Grouping).

IsExplicitOriginCellChangeBlocked bool

Gets a value indicating whether an explicit Origin Cell change is currently blocked (will block Origin Cell changes initiated via LoadWorldRegion and ChangeOriginCell, so query this property before calling these methods if you want to ensure they succeed).

IsInitialized bool

Gets a value indicating whether the World has been initialized.

Pre Init Safe

IsOriginCellUpdateInProgress bool

Gets a value indicating whether an Origin Cell Update (either explicit or a natural World Reset) is currently in progress. Does not return true if an update is queued; use IsOriginCellUpdateQueuedOrInProgress if you need to know that.

Pre Init Safe

IsOriginCellUpdateQueuedOrInProgress bool

Gets a value indicating if an Origin Cell Update is currently in progress or has been queued. If you only want to know if an update is in progress, use IsOriginCellUpdateInProgress istead.

Pre Init Safe

IsSleeping bool

Gets a value indicating whether the world is sleeping (Update cycle not running).

Pre Init Safe

IsUpdateInProgress bool

Gets a value indicating whether a World update is in progress. This will return true if WorldState is >= WorldState.PerformingSecondaryOperation.

IsWorldPersistent bool

Gets a value indicating whether the World is persistent between game sessions. Non prototype Worlds added in the editor are always persistent!

OriginCell Cell

The current Origin Cell of the World, which will always be a Cell on the World's Grid.

Not valid until after the Component Manager has been initialized.

Remember that the Origin Cell of Zone Groupings will not usually be the same as this value. You can find out the Origin Cell of a Zone Grouping after the World has been initialized using the GetOriginCellOfZoneGrouping method.

OriginCellPosition Vector3Double

Gets the position of the Origin Cell (associated with World Grouping 1), which is always equal to the world origin configured in the inspector (or the position of the game object the World is on if 'Use this Game Object's Positoin as World Origin Position' is enabled.

Not valid until after the Component Manager has been initialized.

Remember that the Origin Cell position of Sub Groupings (Groupings 2+) is not necessarily the same as this value. You can find out the Origin Cell position of a Sub Grouping after the World has been initialized using the method.

OriginCellPosition_PreInitSafe Vector3Double

Gets the position of the Origin Cell (associated with World Grouping 1), which is always equal to the world origin configured in the inspector (or the position of the game object the World is on if 'Use this Game Object's Positoin as World Origin Position' is enabled.

This can be used in the editor or at any other time when you are not sure if the World has been initialized. However, if you know that the World has been initialized, use OriginCellPosition instead, as it is much faster!

Remember that the Origin Cell position of Sub Groupings (Groupings 2+) is not necessarily the same as this value. You can find out the Origin Cell position of a Sub Grouping after the World has been initialized using the method.

OriginColumnPosition double

The position of the Origin Cell column (associated with World Grouping 1). It will always be the x value of the OriginCellPosition.

Not valid until after the Component Manager has been initialized.

OriginLayerPosition double

The position of the Origin Cell layer (associated with World Grouping 1). For 3D and 2D XZ Base Groupings, it will be the y component of the OriginCellPosition. For 2D XY Base Groupings, it will be the z component of the OriginCellPosition.

Not valid until after the Component Manager has been initialized.

OriginRowPosition double

The position of the Origin Cell row (associated with World Grouping 1). For 3D and 2D XZ Base Groupings, will be the z value of the OriginCellPosition. For 2D XY Base Groupings, will be the y value of the OriginCellPosition.

Not valid until after the Component Manager has been initialized.

PredominantAxesType Axes

Gets the predominant axes type for the World. This is set at runtime based on all of the Streamable Grids used by the World.

If all Streamable Grids use 2D XY, the World will have a Predominant Axes Type of 2D XY. If all Streamable Grids use 3D, it will be 3D. For cases where all Streamable Grids use 2D XZ, or a combination of 2D XZ and 3D, it will be 2D XZ.

If the Predominant Axes Type is 2D, the World's Use Endless Layers setting will be ignored and the Origin Cell Layer of the World will be fixed to a value of 1.

StartingColumn int

The Starting Column of this World in reference to its World Grid. This is basically the smallest column that any zone is in minus West Gap Cells.

StartingColumn_ZeroBased int

The Starting Column of this World in reference to its World Grid. This is basically the smallest column that any zone is in minus West Gap Cells.

StartingLayer int

The Starting Layer of this World in reference to its World Grid. This is basically the smallest layer that any zone is in minus Bottom Gap Cells.

StartingLayer_ZeroBased int

The Starting Layer of this World in reference to its World Grid. This is basically the smallest layer that any zone is in minus Bottom Gap Cells.

StartingRow int

The Starting Row of this World in reference to its World Grid. This is basically the smallest row that any zone is in minus South Gap Cells.

StartingRow_ZeroBased int

The Starting Row of this World in reference to its World Grid. This is basically the smallest row that any zone is in minus South Gap Cells.

TotalColumns int

The Total Column on this World in reference to its World Grid. This is equal to EndingColumn - StartingColumn + 1;

TotalLayers int

The Total Layers on this World in reference to its World Grid. This is equal to EndingLayer - StartingLayer + 1;

TotalRows int

The Total Rows on this World in reference to its World Grid. This is equal to EndingRow - StartingRow + 1;

WorldGroupings int

Gets a value indicating how many World Groupings this world uses.

Pre Init Safe

WorldHeight double

The height of the World as measured from its Starting Layer to its Ending Layer.

WorldLength double

The length of the World as measured from its Starting Row to its Ending Row.

WorldRegions int

Gets the number of World Regions stored on this World.

Pre Init Safe

WorldSleepMode WorldSleepMode

Gets or Sets the World Sleep Mode used by this World. This controls under what conditions the World is put to sleep (see WorldSleepMode page for more info).

Pre Init Safe

WorldState WorldState

Gets the Current WorldState of the World.

Pre Init Safe

WorldWidth double

The width of the World as measured from its Starting Column to its Ending Column.

Zones int

Gets a value indicating how many Zones this world uses.

Pre Init Safe

Methods

AddCellUsers(IList<Cell>, int, int, int)

public void AddCellUsers(IList<Cell> cells, int zoneIndex, int groupingIndex, int lodIndex)

Sends in a request to add users to the list of specified cells. This method should only be used by advanced users, as in 99% of cases you should let the Active Grid class control the addition of cell users. If you do decide to use this method, keep the following in mind:

The World tallies all user requests (either add or remove) for World Cells. If the Active Grid sends in an add requests for a specific cell, then you send in an add requests for the same cell, a tally of 2 will exists for the cell. The cell is then loaded and will not be unloaded until the tally reaches 0. In this way, multiple users can lay claim to a cell, and rather than loading that cell multiple times, it is only loaded once.

This strategy introduces errors if you do not keep track of the users you have added to a cell, however. For every user you add, you will typically want to remove a user for the same cell at a later time. If you do not, the cell will likely never be unloaded.

Parameters

Name Type Description
cells IList<Cell>

The list of cells to add users to.

zoneIndex

The index of the Zone the cells are associated with.

groupingIndex int

The index of the World Grouping the cells are associated with.

lodIndex int

The index of the LOD the cells are associated with.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown if the method is called before the World has been initialized.
InvalidOperationException Thrown if the method is called while the world is in the process of being destroyed.
ArgumentException Thrown if the groupingIndex or lodIndex passed in are invalid.

AddCellUsers(IList<LODCell>, int, int)

public void AddCellUsers(IList<LODCell> cells, int zoneIndex, int groupingIndex)

Sends in a request to add users to the list of specified cells, in the form of a list of LODCells. This method should only be used by advanced users, as in 99% of cases you should let the Active Grid class control the addition of cell users. If you do decide to use this method, keep the following in mind:

The World tallies all user requests (either add or remove) for World Cells. If the Active Grid sends in an add requests for a specific cell, then you send in an add requests for the same cell, a tally of 2 will exists for the cell. The cell is then loaded and will not be unloaded until the tally reaches 0. In this way, multiple users can lay claim to a cell, and rather than loading that cell multiple times, it is only loaded once.

This strategy introduces errors if you do not keep track of the users you have added to a cell, however. For every user you add, you will typically want to remove a user for the same cell at a later date. If you do not, the cell will likely never be unloaded.

Parameters

Name Type Description
cells IList<LODCell>

The list of LOD cells to add users to.

zoneIndex

The index of the Zone the cells are associated with.

groupingIndex int

The index of the World Grouping the cells are associated with.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown if the method is called before the World has been initialized.
InvalidOperationException Thrown if the method is called while the world is in the process of being destroyed.
ArgumentException Thrown if the groupingIndex passed in is invalid.

AddCellUsers(IList<WorldGroupingCell>)

public void AddCellUsers(IList<WorldGroupingCell> cells)

Sends in a request to add World Cell users for the passed in cells, in the form of a list of WorldGroupingCells. This method should only be used by advanced users, as in 99% of cases you should let the Active Grid class control the addition of cell users. If you do decide to use this method, keep the following in mind:

The World tallies all user requests (either add or remove) for World Cells. If the Active Grid sends in an add requests for a specific cell, then you send in an add requests for the same cell, a tally of 2 will exists for the cell. The cell is then loaded and will not be unloaded until the tally reaches 0. In this way, multiple users can lay claim to a cell, and rather than loading that cell multiple times, it is only loaded once.

This strategy introduces errors if you do not keep track of the users you have added to a cell, however. For every user you add, you will typically want to remove a user for the same cell at a later date. If you do not, the cell will likely never be unloaded.

Please note, to save on performance, no error checking is done on the passed in Zone Indexes, World Grouping or LOD indexes, so please be sure that those values are valid!

Parameters

Name Type Description
cells IList<WorldGroupingCell>

The list of cells to add World Cell users to.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown if the method is called before the World has been initialized.
InvalidOperationException Thrown if the method is called while the world is in the process of being destroyed.

AddWorldGroupingListener(IWorldGroupingListener, int)

public void AddWorldGroupingListener(IWorldGroupingListener groupingListener, int groupingIndex)

Adds the IWorldGroupingListener to the World Grouping indicated by groupingIndex. Listeners are added/removed on a per Grouping basis, not a per Zone Grouping basis, so when you add/remove a listener for a World Grouping, all Zones that contain a valid Streamable Grid for that Grouping will have the listener added/removed.

DetermineMethodCalls and PrecomputeUseWithLODValues are called automatically when using this method.

Parameters

Name Type Description
groupingListener IWorldGroupingListener

The World Grouping listener to add.

groupingIndex int

The index of the World Grouping to add the World Grouping listener to. If you want to add the listener to multiple World Groupings, call this method multiple times, once for each World Grouping.


CalculateShiftResultingFromNewOriginCell(Cell)

public Vector3Double CalculateShiftResultingFromNewOriginCell(Cell newOriginCell)

Calculates the amount the world would be shifted if the Origin Cell of the world was changed to a new Origin Cell. Note that this does not actually perform an Origin Cell Change.

This method merely calculates how much the world would be shifted if the passed in cell were made the Origin Cell.

This Origin Cell is always in reference to the World Grid.

Parameters

Name Type Description
newOriginCell Cell

The new Origin Cell of the World to use in the calculation (on Grouping 1).

Returns

Vector3Double
The amount of shift that would result from the Origin Cell change.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

ChangeAllGroupNamesOnZone(int, string[][], [Action<World>])

public void ChangeAllGroupNamesOnZone(int zoneIndex, string[][] newGroupNames, Action<World> onCompletedCallback = null)

Changes the Group Names of all LOD Groups for all Zone Groupings in the specified Zone (changes persistent with save data if World is persistent).

A rudimentary check is performed to try to catch instances when this method is called unecessarily. The check is performed separately for each World Grouping on the World, according to the following rules:

1) If all LODs on a Zone Grouping are already using the passed in Group Names, no Group Name change occurs for that Grouping (however the callback, if provided, is still invoked).
2) If only one LOD is not using the passed in Group Name for that LOD, only that LOD's Group Name is changed.
3) If more than one LOD is not using the passed in Group Name for those LODs, all LODs on the Zone Grouping are changed, regardless of whether each LOD is already using the passed in Group Name (as such, this may result in an unecessary refresh of the chunks on those LODs).

If you know only a few World Groupings need to be changed, it is better to use the method that targets a specific World Grouping.

If you know only a few LODs need to be changed, use the methods that target specific LODs on specific World Groupings.

The world is automatically refreshed and Asset Chunks changed out as a result of the Group Name changes, so this method should only be used when the world is hidden from the player (otherwise the player may see the change), and probably when the game is paused (so the player does not fall through the world).

Please note, all Group Name changes operate by performing LOD transitions from each World Cell currently belonging to the LOD of the World Grouping to a new World Cell of the same LOD but using the new Asset Chunks. This is important, as your custom World Grouping Listeners will only be notified of these updates if their IgnoreLODTransitions property is set to return false.

The operation is performed as a secondary operation using the World's update cycle, and as such if the World is currently in the process of being updated, or another secondary operation is in progress, those updates will be completed before this one begins execution. Once the new group names have been applied and Asset Chunks refreshed to use the new names, the onCompletedCallback action will be called.

Parameters

Name Type Description
zoneIndex int

The index of the Zone you wish to change.

newGroupNames string[][]

The new group names. The first array index corresponds to the World Grouping, while the second index is the LOD group on that World Grouping. The lengths must match the number of World Groupings on this world, plus the number of LODs on each World Grouping.

onCompletedCallback Action<World>

An optional action that will be called after the Group Name change operation has been completed.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World has been initialized.
InvalidOperationException Thrown when the method is called while the World is in the process of being destroyed.
ArgumentException Thrown when the length of the newGroupNames array does not match the number of World Groupings on this world, or one or more of the arrays within the main array do not match the number of LODs for that World Grouping (i.e., newGroupNames[0].Length does not match the number of LODs on World Grouping 1 (remember, the 0th index stores World Grouping 1, index 1 stores World Grouping 2, etc.)

ChangeAllGroupNamesOnZoneGrouping(int, int, string[], [Action<World>])

public void ChangeAllGroupNamesOnZoneGrouping(int zoneIndex, int groupingIndex, string[] newGroupNames, Action<World> onCompletedCallback = null)

Changes the Group Names of all LOD's for the specified Zone Grouping (changes persistent with save data if World is persistent).

A rudimentary check is performed to try to catch instances when this method is called unecessarily. This check adheres to the following rules:

1) If all LODs on the World Grouping are already using the passed in Group Names, no Group Name change occurs (however the callback, if provided, is still invoked).
2) If only one LOD is not using the passed in Group Name for that LOD, only that LOD's Group Name is changed.
3) If more than one LOD is not using the passed in Group Name for those LODs, Group Names for all LODs on the World Grouping are changed, regardless of whether each LOD is already using the passed in Group Name (as such, this may result in an unecessary refresh of the chunks on those LODs). If you know only a few LODs need to be changed, use multiple calls to the method that target specific LODs on the World Grouping.

The world is automatically refreshed as a result of the Group Name changes, so this method should only be used when the world is hidden from the player (otherwise the player may see the change), and probably when the game is paused (so the player does not fall through the world).

Please note, all Group Name changes operate by performing LOD transitions from each World Cell currently belonging to the LOD of the World Grouping to a new World Cell of the same LOD but using the new Asset Chunks. This is important, as your custom World Grouping Listeners will only be notified of these updates if their IgnoreLODTransitions property is set to return false.

The operation is performed as a secondary operation using the World's update cycle, and as such if the World is currently in the process of being updated, or another secondary operation is in progress, those updates will be completed before this one begins execution. Once the new group names have been applied and objects refreshed to use the new names, the onCompletedCallback action will be called.

Parameters

Name Type Description
zoneIndex int

The 1 based index of the Zone whose LOD Group Names you wish to modify.

groupingIndex int

The 1 based index of the World Grouping whose LOD Group Names you wish to modify.

newGroupNames string[]

The new group names. Each array index corresponds to an LOD group.

onCompletedCallback Action<World>

An optional action that will be called after the Group Name change operation has been completed.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World has been initialized.
InvalidOperationException Thrown when the method is called while the World is in the process of being destroyed.
ArgumentException Thrown when the length of the newGroupNames array does not match the number LODs on the specified World Grouping.

ChangeGroupName(string, [Action<World>])

public void ChangeGroupName(string newGroupName, Action<World> onCompletedCallback = null)

Changes the Group Name of LOD Group 1 on World Grouping 1 of Zone 1 (change persistent with save data if World is persistent).

A check is performed to ensure the current Group Name is not equal to the passed in Group Name. Nothing will happen if they are the same, although the callback (if provided) will still be invoked.

The world is automatically refreshed as a result of the Group Name change, so this method should only be used when the world is hidden from the player (otherwise the player may see the change), and probably when the game is paused (so the player does not fall through the world).

Please note, all Group Name changes operate by performing LOD transitions from each World Cell currently belonging to the LOD of the World Grouping to a new World Cell of the same LOD but using the new chunks. This is important, as your custom World Grouping Listeners will only be notified of these updates if their IgnoreLODTransitions property is set to return false.

The operation is performed as a secondary operation using the World's update cycle, and as such if the World is currently in the process of being updated, or another secondary operation is in progress, those updates will be completed before this one begins execution. Once the new Group Name has been applied and objects refreshed to use that name, the onCompletedCallback action will be called.

Parameters

Name Type Description
newGroupName string

The new Group Name.

onCompletedCallback Action<World>

An optional action that will be called after the Group Name change operation has been completed.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World has been initialized.
InvalidOperationException Thrown when the method is called while the World is in the process of being destroyed.

ChangeGroupName(int, int, int, string, [Action<World>])

public void ChangeGroupName(int zoneIndex, int groupingIndex, int lodIndex, string newGroupName, Action<World> onCompletedCallback = null)

Changes the Group Name of the specified LOD for the specified Zone Grouping (change persistent with save data if World is persistent).

A check is performed to ensure the current Group Name is not equal to the passed in Group Name. Nothing will happen if they are the same, although the callback (if provided) will still be invoked.

The world is automatically refreshed as a result of the Group Name change, so this method should only be used when the world is hidden from the player (otherwise the player may see the change), and probably when the game is paused (so the player does not fall through the world).

Please note, all Group Name changes operate by performing LOD transitions from each World Cell currently belonging to the LOD of the World Grouping to a new World Cell of the same LOD but using the new chunks. This is important, as your custom World Grouping Listeners will only be notified of these updates if their IgnoreLODTransitions property is set to return false.

The operation is performed as a secondary operation using the World's update cycle, and as such if the World is currently in the process of being updated, or another secondary operation is in progress, those updates will be completed before this one begins execution. Once the new Group Name has been applied and objects refreshed to use that name, the onCompletedCallback action will be called.

Parameters

Name Type Description
zoneIndex int

The 1 based index of the Zone whose LOD Group Name you wish to modify.

groupingIndex int

The 1 based index of the World Grouping whose LOD Group Name you wish to modify.

lodIndex int

The 1 based index of the LOD on the World Grouping whose Group Name you wish to modify.

newGroupName string

The new Group Name.

onCompletedCallback Action<World>

An optional action that will be called after the Group Name change operation has been completed.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World has been initialized.
InvalidOperationException Thrown when the method is called while the World is in the process of being destroyed.

ChangeOriginCell(Cell)

public bool ChangeOriginCell(Cell newOriginCell)

Changes the Origin Cell of the World. The update does not occur immediately but rather during the natural World Update cycle. If you need to know when the world update containing the Origin Cell update has finished, you can register a callback method with the World via the RegisterOnUserRequestsFulfilledCallback method. The callback method will be invoked once the Origin Cell change has been completed.

In order to ensure the change can be made, you should query the IsExplicitOriginCellChangeBlocked property and ensure it is false before calling the method. If you decide to forsake this strategy and the update fails, a warning message will be printed to the console and the method will return false.

Setting the Origin Cell manually may have unintended consequences, especially when using an Active Grid. Therefore, it is recommended for advanced users only! Generally it is better to let the Active Grid change the Origin Cell, either automatically when the player crosses a reset boundary, or manually as a result of one its other methods being called, like TryMovePlayerAndChangeOriginCellOfWorld

Parameters

Name Type Description
newOriginCell Cell

The new Origin Cell.

Returns

bool
True if Origin Cell will be changed, false otherwise. If true, remember that the actual change does not occur immediately, but rather will be caried out during a normal World update cycle.


ClampOriginCells(bool, bool, [Action<World>])

public ClampingOperationInfo ClampOriginCells(bool updateHiearchyOrganizers, bool notifyUsersInSingleFrame, Action<World> onCompletedCallback = null)

Clamps the world's Origin Cells. Clamping can only occur when the world utilizes one or more endless axes.

The process of clamping takes the current World's Origin Cell value and translates it to a value that falls between the normal Starting and Ending Cell of the World (which is determined by the layout of your Zones). Each Zone Grouping's Origin Cell is also translated in a way that is consistent with the translation of the World's Origin Cell. All loaded World Cells on each Zone Grouping have their Cell On Endless Grid value adjusted during the clamp.

For example, imagine you have a World with a single Zone Grouping, that is using a Streamable Grid with only 2 Rows. On a world with non endless rows, cells in this Zone Grouping (upon being loaded into the scene) can only have a row value of 1 or 2, which match perfectly with their Streamable Grid indexes. However, on an world with endless rows, once the world repeats on the row axis, the cells will have values 3 and 4, 5 and 6, 7 and 8, and so on, until infinity. And of course the world can repeat in the opposite direciton as well and have values like 0 and -1, -2 and -3, and so on. The Origin Cell of the World uses a similar Endless World Grid, for many reasons.

Origin Cells of course cannot reach into infinity, since they are represented by a fixed max/min value data type (in this case, integer), so astute observers will note that this system of handling things has the (incredibly minute) chance of causing issues in some rare cases (when the player plays the game for a long, long time). As such, Origin Clamping is an option to rectify the problem (and please, do consider your particular use case to determine if this problem is even possible!!).

If our Origin Cell has a Row of 5 and the World's Rows range between -2 and 2, we can note that this row 5 cell is equivalent to a row 0 cell. The goal of clamping, then, is to take the row 5 World Origin Cell and shift it so its value is 0. In this case, we must shift 5 by -5 to get it to 0. Easy, right?

Yes and no. While the Origin Cell has been shifted, any data that is dependent on the Origin Cell is now invalidated, as the data is dependent on the Origin Cell having a row value of 5. Therefore, we must also shift (by -5) any data that was dependent on the origin row being 5, in order to bring that data in line with our Origin Cell shift.

As such, this method will automatically notify World Users (registered with the World via the Register method) of the clamping, so that data can be updated (notification occurs in full before the call back is triggered).

Because the clamping operation can only be initiated manually by you, the developer, World Users are not queried to make sure the clamping operation can proceed. This differs from how normal Origin Cell changes occur. This decision was made because you should be in full control of all World Users in your game; therefore, you should know if the clamping operation would interfere with any operations the users have in progress, and you can delay the clamping operation until after those operations complete. For example, it is usually a bad idea to perform a clamping operation while a save is in progress!

Parameters

Name Type Description
updateHiearchyOrganizers bool

If true, when a hierarchy organizer is assigned to this World, all World Chunks will be removed and then re-added to the organizer after modifying the World Cell data each object belongs to. This should only be necessary if you are using the Endless Grid Cell indexes of the World Cell to organize the objects, for example when using a Standard Hiearchy Organizer with the "Group Objects From Same Base Cell" option and/or "Group Objects From Same World Cell" options enabled.

notifyUsersInSingleFrame bool

Whether registered users should be notified in a single frame. If false, a single user will be notified and after the World will query the Execution Controller to determine if it should yield. Note that depending on your execution controller, multiple (or even all users) may be notified in a single frame. If true, all users are notified in a single frame instead.

onCompletedCallback Action<World>

An optional call back action that will be triggered after the operation completes.

Returns

ClampingOperationInfo
Information about the Clamping Operation. Only valid after the onCompletedCallback has triggered! The same object is reused for each Clamping Operation, which means the data in the Info will be cleared automatically each time a Clamping Operation is executed.

Do note, however, that the origin cell data should only be relied upon in the short time after onCompletedCallback is triggered, since the Origin Cell may change as a result of an Origin Cell change operation.

If you want to free up memory, you can call the ClearMemory method on this object, but only after onCompletedCallback is triggered and you have used the object's data as you need.


CreateWorldCell(Cell, int, int, int)

public WorldCell CreateWorldCell(Cell endlessGridCell, int LOD, int groupingIndex, int zoneIndex)

Creates a World Cell based on the passed in endlessGridCell, LOD, World Grouping index, and Zone index. The data will be properly set, and the World Cell will be setup to be able to receive chunk attachments, however no objects will actually be associated with this Cell.

There are few use cases where you would need to use this method, one of them being when creating custom Chunk Managers that have pooled objects no longer associated with a World Cell that you need to unload.

In that case, in order to unload them properly with an existing Chunk Streamer, you can generate a sort of dummy World Cell using this method, attach your objects to the cell, and then use the DetachAndUnloadChunksFromCells method of the Chunk Streamer to unload the objects.

When creating a World Cell using this method, it is not used internallly by SAM at all. It's for your own use only. The objects are generated using the internal pool of World Cells, so the type of the World Cell may be a WorldCellWithTerrain if the LOD and World Grouping index you pass in reference an LOD Group that utilizes terrain.

The internal array that stores game objects within the World Cell will be configured properly so that you can attach chunks to the cell via the WorldCell.AttachChunkToCell method.

You can return the WorldCell for pooling after you are done with it by calling the ReturnWorldCellForPooling method.

Note, if you have created a World Cell already for an Endless Grid Cell, and you need another World Cell for the same Endless Grid Cell, it is faster to use the CreateWorldCellCopy method rather than this one (assuming you have not returned the first World Cell).

Parameters

Name Type Description
endlessGridCell Cell

The Endless Grid Cell of the World Cell. This is used to calculate all the data of the World Cell.

LOD int

The LOD of the cell, also used to calculate the data of the World Cell, and set its number of chunks properly.

groupingIndex int

The index of the World Grouping you want to use to create the cell, also used to setup data correctly.

zoneIndex int

The Zone you want to use to create the cell, also used to setup data correctly.

Returns

WorldCell
The created World Cell.

Exceptions

Type Condition
UninitializedSAMObjectException thrown when the method is called before the World has been initialized.

CreateWorldCellCopy(WorldCell)

public WorldCell CreateWorldCellCopy(WorldCell worldCell)

Creates a World Cell as a copy of another World Cell. If there are chunks associated with the World Cell, they will not be copied over to the new cell, however the new cell will be properly setup to be able to store the proper number of Asset Chunks.

There are few use cases where you would need to use this method, one of them being when creating custom Chunk Managers that have pooled objects no longer associated with a World Cell that you need to unload.

In that case, in order to unload them properly with an existing Chunk Streamer, you can generate a sort of dummy World Cell using the CreateWorldCell method, and then for each additional World Cell you need to represent the same Endless Grid Cell, use this method to generate a new World Cell. This is faster than using CreateWorldCell multiple times for the same Endless Grid Cell.

When creating a World Cell using this method, it is not used internallly by SAM at all. It's for your own use only. The World Cell is generated using the internal pool of World Cells, so the type of the World Cell may be a WorldCellWithTerrain if the LOD and World Grouping index you pass in reference an LOD that utilizes terrain.

The internal array that stores Asset Chunks within the World Cell will be configured properly so that you can attach chunks to the cell via the WorldCell.AttachChunkToCell method.

You can return the WorldCell for pooling after you are done with it by calling the ReturnWorldCellForPooling method.

Parameters

Name Type Description
worldCell WorldCell

The World Cell to copy.

Returns

WorldCell
The created World Cell.

Exceptions

Type Condition
UninitializedSAMObjectException thrown when the method is called before the World has been initialized.

DeRegister(int)

public void DeRegister(int registrationID)

Deregister a World User from the World. Note that if the user is Currently "prepared" for an Origin Cell change, they will NOT receive notification from the World once the Origin Cell change is completed.

Parameters

Name Type Description
registrationID int

The ID of the user that should be de registered. This ID was assigned to you when you registered with the World via the Register method.


DetermineZoneGroupingOriginCellFromWorldOriginCell_PreInitSafe(int, int, Cell, out Vector3Double)

public Cell DetermineZoneGroupingOriginCellFromWorldOriginCell_PreInitSafe(int zoneIndex, int groupingIndex, Cell theoreticalWorldOriginCell, out Vector3Double zoneGroupingOriginCellPosition)

Can be used to determine what Origin Cell a Zone Grouping would have if the Origin Cell of the World were changed to the theoreticalOriginCell.

The Zone Grouping Origin Cell is always the Endless Grid Cell on the Zone Grouping that is closest to the Origin Position of the World. Note that it is possibe for multiple Endless Grid Cells on the Zone Grouping to be the same distance from the Origin Position. In these cases, usually the Cell with the smallest position is used.

Parameters

Name Type Description
zoneIndex int

The one based index of the Zone you are interested in.

groupingIndex int

The one based index of the World Grouping you are interested in.

theoreticalWorldOriginCell int

The one based theoretical Origin Cell of the World to use in the calculation of the Zone Grouping Origin Cell.

zoneGroupingOriginCellPosition out Vector3Double

The position of the Zone Grouping Origin Cell within the scene.

Returns

Cell
The one based Zone Grouping Origin Cell as determined by the method.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

FindEndlessGridCellPositionIsInOrClosestTo(Vector3Double, int, int, out bool)

public Cell FindEndlessGridCellPositionIsInOrClosestTo(Vector3Double position, int zoneIndex, int groupingIndex, out bool positionIsInCell)

Finds the Endless Grid Cell that the specified position falls within on this World (given the current Origin Cell of the World), for the specified Zone and World Grouping. If the position does not fall in an actual Cell of the Zone, the returned Cell will be the closest Cell to the position instead.

Bear in mind that if the Zone Grouping is Two Dimensional, the position will always be considered inside of Layer 1, even if technically it falls outside of the Layer's Bounds as set on your Streamable Grid.

Parameters

Name Type Description
position Vector3Double

The position in world space.

zoneIndex int

The index of the Zone which contains the Endless Grid Cell in question.

groupingIndex int

The index of the World Grouping which contains the Endless Grid Cell in question.

positionIsInCell out bool

Whether the position is in the return Cell. If false, it means the position is outside of the Cell/Zone but that the returned Cell is the closest Cell to the position.

Returns

Cell
The Endless Grid Cell the position falls within or is closest to.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

FindEndlessGridCellPositionIsInOrClosestTo(Vector3Double, int, int, out bool, out Vector3Double)

public Cell FindEndlessGridCellPositionIsInOrClosestTo(Vector3Double position, int zoneIndex, int groupingIndex, out bool positionIsInCell, out Vector3Double endlessGridCellPosition)

Finds the Endless Grid Cell (and it's position) that the specified position falls within on this World (given the current Origin Cell of the World), for the specified Zone and World Grouping. If the position does not fall in an actual Cell of the Zone, the returned Cell will be the closest Cell to the position instead.

Bear in mind that if the Zone Grouping is Two Dimensional, the position will always be considered inside of Layer 1, even if technically it falls outside of the Layer's Bounds as set on your Streamable Grid.

Parameters

Name Type Description
position Vector3Double

The position in world space.

zoneIndex int

The index of the Zone which contains the Endless Grid Cell in question.

groupingIndex int

The index of the World Grouping which contains the Endless Grid Cell in question.

positionIsInCell out bool

Whether the position is in the return Cell. If false, it means the position is outside of the Cell/Zone but that the returned Cell is the closest Cell to the position.

endlessGridCellPosition out Vector3Double

The position in the scene of the returned Endless Grid Cell.

Returns

Cell
The Endless Grid Cell the position falls within or is closest to.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

FindEndlessGridCellPositionIsInOrClosestTo(Vector3Double, int, int, out Vector3Double, out bool)

public Cell FindEndlessGridCellPositionIsInOrClosestTo(Vector3Double position, int zoneIndex, int groupingIndex, out Vector3Double endlessGridCellPosition, out bool positionIsInCell)

Finds the Endless Grid Cell that the specified position falls within on this World (given the current Origin Cell of the World), for the specified Zone and World Grouping. If the position does not fall in an actual Cell of the Zone, the returned Cell will be the closest Cell to the position instead.

Also outputs the position of the returned Cell.

Parameters

Name Type Description
position Vector3Double

The position in world space.

endlessGridCellPosition out Vector3Double

The position of the Endless Grid Cell within the scene.

zoneIndex int

The index of the Zone which contains the Endless Grid Cell you want to find.

groupingIndex int

The index of the World Grouping which contains the Endless Grid Cell you want to find.

positionIsInCell out bool

Whether the position is in the return Cell. If false, it means the position is outside of the Cell/Zone but that the returned Cell is the closest Cell to the position.

Returns

Cell
The Endless Grid Cell the position falls within.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

FindEndlessGridCellPositionIsInOrClosestToUsingInitialOriginCell(Vector3Double, int)

public Cell FindEndlessGridCellPositionIsInOrClosestToUsingInitialOriginCell(Vector3Double position, int groupingIndex)

Finds the Endless Grid Cell that the input position would be in or be closest to if the Origin Cell of this world were equal to its initial Origin Cell (as set in the inspector of your World).

Note that if you use clamping, the endless cell indexes will be adjusted, so you cannot rely on the cell indexes remaining constant. For a non endless world clamping cannot be used therefore it is not an issue.

Finally, keep in mind that the Endless Grid Cell is in reference to the World Grouping you specify via groupingIndex, but the Origin Cell is always in reference to the World's Grid.

Parameters

Name Type Description
position Vector3Double

The position in world space.

groupingIndex int

The index of the World Grouping which contains the Endless Grid Cell in question.

Returns

Cell
The Endless Grid Cell the position would be in if the initial Origin Cell was the Origin Cell of this world.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

FindEndlessGridCellPositionIsInUsingTheoreticalOriginCell(Vector3Double, Cell, int)

public Cell FindEndlessGridCellPositionIsInUsingTheoreticalOriginCell(Vector3Double position, Cell theoreticalOriginCell, int groupingIndex)

Finds the Endless Grid Cell that the input position would be in if the Origin Cell of this world were equal to the theoretical Origin Cell provided.

This is useful if you're about to change the Origin Cell via the Active Grid's TryMovePlayerAndChangeOriginCellOfWorld method and need to calculate some data based on the new Origin Cell.

Finally, keep in mind that the Endless Grid Cell is in reference to the World Grouping you specify via groupingIndex, but the Origin Cell is always in reference to the Base Grouping (Grouping 1).

Parameters

Name Type Description
position Vector3Double

The position in world space.

theoreticalOriginCell

The theoretical Origin Cell (from the Base Grouping) to use to find the Endless Grid Cell.

groupingIndex int

The index of the World Grouping which contains the Endless Grid Cell in question.

Returns

Cell
The Endless Grid Cell the position would be in if the theoretical Origin Cell was the Origin Cell of this world.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

FindEndlessGridCellsPositionIsInAcrossAllZones(Vector3Double, int, List<ZoneGroupingCell>)

public void FindEndlessGridCellsPositionIsInAcrossAllZones(Vector3Double position, int groupingIndex, List<ZoneGroupingCell> cells)

Finds all Endless Grid Cells that a position is in across all Zones for a given World Grouping.

This is useful if you don't care what Zone the position is in.

Parameters

Name Type Description
position Vector3Double

The position in world space.

groupingIndex int

The index of the World Grouping which contains the Streamable Grid Cell in question.

cells List<ZoneGroupingCell>

The list to add the cells to. ZoneGroupingCell is used so that you will know which Zone each Cell is in.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

FindEndlessGridCellsPositionIsInAcrossAllZonesAndGroupings(Vector3Double, List<ZoneGroupingCell>)

public void FindEndlessGridCellsPositionIsInAcrossAllZonesAndGroupings(Vector3Double position, List<ZoneGroupingCell> cells)

Finds all Endless Grid Cells that a position is in across all Zones and World Groupings.

This is useful if you don't care what Zone or World Grouping the position is in.

Parameters

Name Type Description
position Vector3Double

The position in world space.

cells List<ZoneGroupingCell>

The list to add the cells to. ZoneGroupingCell is used so that you will know which Zone and World Grouping each Cell is in.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

FindEndlessGridCellsPositionsAreIn(NativeArray<Vector3Double>, NativeArray<Cell>, int, [bool])

public JobHandle FindEndlessGridCellsPositionsAreIn(NativeArray<Vector3Double> positions, NativeArray<Cell> cells, int groupingIndex, bool initializeWorkImmediately)

Can be used to find the endless grid cells that a batch of positions fall within. You can either queue up another Job that is dependent on the returned JobHandle, or use JobHandle.IsCompleted to ensure the job is completed (and then call JobHandle.Complete() after). The cells array data will only be valid after the job has completed!

Parameters

Name Type Description
positions NativeArray<Vector3Double>

The batch of positions to process. It should be initialized with either the TempJob Allocator or Persistent Allocator (if TempJob results in errors).

Remember to dispose of the array after you are finished using the data (usually after calling this method).

cells NativeArray<Cell>

Contains the Endless Grid Cell each position is in after the job completes. It should be initialized before calling this method with either the TempJob Allocator or Persistent Allocator (if TempJob results in errors). You can also initialize the array with UninitializedMemory for a bit faster code.

Remember to dispose of this array after you have finished using the data!

groupingIndex int

The index of the World Grouping that the Endless Grid Cells are associated with.

initializeWorkImmediately bool

If true, the jobs which perform the endless grid identification will be scheduled and started before the job is returned, using the JobHandle.ScheduleBatchedJobs method.

If false, the job will be scheduled but the threads will not actually start working on the jobs. This is useful if you have additional jobs that you would like to schedule that depend on the returned JobHandle, as it is more performant to schedule those jobs and then call ScheduleBatchedJobs yourself.

Note that if you do not call ScheduleBatchedJobs after passing in false for this parameter, the returned JobHandle will never be completed!

Returns

JobHandle
A Job Handle that will have been scheduled. Use IsCompleted to check if it is complete, then call Complete afterwards before accessing the data in the cells array.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

FindStreamableGridCellPositionIsIn(Vector3Double, int, int, out bool)

public Cell FindStreamableGridCellPositionIsIn(Vector3Double position, int zoneIndex, int groupingIndex, out bool positionIsInCell)

Finds the Streamable Grid Cell that the specified position falls within on this World (given the current Origin Cell of the World).

This uses the current Origin Cell of the World in the calculation. If you need to use the initial Origin Cell of the World, or a theoretical Origin Cell, use FindEndlessGridCellPositionIsInUsingInitialOriginCell or FindEndlessGridCellPositionIsInUsingTheoreticalOriginCell, then covert the Endless Grid Cell returned to a Streamable Grid Cell using the Streamable Grid's ConvertCellOnEndlessGridToCellOnStreamableGrid method.

Parameters

Name Type Description
position Vector3Double

The position in world space.

zoneIndex int

The index of the Zone which contains the Streamable Grid Cell in question.

groupingIndex int

The index of the World Grouping which contains the Streamable Grid Cell in question.

positionIsInCell out bool

True if the position is inside the returned Cell, false otherwise.

Returns

Cell
The Streamable Grid Cell the position falls within.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

FindStreamableGridCellsPositionsAreIn(NativeArray<Vector3Double>, NativeArray<Cell>, int, [bool])

public JobHandle FindStreamableGridCellsPositionsAreIn(NativeArray<Vector3Double> positions, NativeArray<Cell> cells, int groupingIndex, bool initializeWorkImmediately)

Can be used to find the streamable grid cells that a batch of positions fall within. You can either queue up another Job that is dependent on the returned JobHandle, or use JobHandle.IsCompleted to ensure the job is completed (and then call JobHandle.Complete() after). The cells array data will only be valid after the job has completed!

Parameters

Name Type Description
positions NativeArray<Vector3Double>

The batch of positions to process. It should be initialized with either the TempJob Allocator or Persistent Allocator (if TempJob results in errors).

Remember to dispose of the array after you are finished using the data (usually after calling this method).

cells NativeArray<Cell>

Contains the Streamable Grid Cell each position is in after the job completes. It should be initialized before calling this method with either the TempJob Allocator or Persistent Allocator (if TempJob results in errors). You can also initialize the array with UninitializedMemory for a bit faster code.

Remember to dispose of this array after you have finished using the data!

groupingIndex int

The index of the World Grouping that the Streamable Grid Cells are associated with.

initializeWorkImmediately bool

If true, the jobs which perform the streamable grid identification will be scheduled and started before the job is returned, using the JobHandle.ScheduleBatchedJobs method.

If false, the job will be scheduled but the threads will not actually start working on the jobs. This is useful if you have additional jobs that you would like to schedule that depend on the returned JobHandle, as it is more performant to schedule those jobs and then call ScheduleBatchedJobs yourself.

Note that if you do not call ScheduleBatchedJobs after passing in false for this parameter, the returned JobHandle will never be completed!

Returns

JobHandle
A Job Handle that will have been scheduled. Use IsCompleted to check if it is complete, then call Complete afterwards before accessing the data in the cells array.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

FindUnboundWorldGridCellPositionIsIn(Vector3Double)

public Cell FindUnboundWorldGridCellPositionIsIn(Vector3Double position)

Finds the Unbound Cell the position is in within the World's imaginary grid, given the current Origin Cell used by the World.

The unbound cell is similar to an endless grid cell, in that its indices are unique for each repeated instance of the World on any axis which have been set to be repeated/endless.

Parameters

Name Type Description
position Vector3Double

The position.

Returns

Cell
The Unclamped World Grid Cell the position is in.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetAllLoadedWorldCells(int, int, List<WorldCell>)

public void GetAllLoadedWorldCells(int zoneIndex, int groupingIndex, List<WorldCell> addCellsTo)

Adds all loaded World Cells for the specified Zone Grouping to the passed in addCellsTo list.

Note that this method gets the currently loaded World Cells as contained in the Grouping's internal dictionary. If the Grouping is in the process of being updated, the World Cells' state cannot be predicted (they may be missing Asset Chunks, or those Asset Chunks may be in a state you do not expect, for example).

As such, it is usually best to call this method only when the World is not currently being updated, which you can check using the IsUpdateInProgress property.

However, the best approach for tracking World Cells is to use a World Grouping Listener, as you can be confident about the state of the World Cells (depending on which method you use for the tracking), and can accurately track when World Cells are added and removed.

World Cells returned via this method can be removed at a moments notice, so you should only make use of them for a very short period of time.

If the World has not been initialized or the Zone Grouping is not in use (because no Streamable Grid was assigned to it, nothing will be added to the list.

Parameters

Name Type Description
zoneIndex int

The index of the Zone whose World Cells you wish to get.

groupingIndex int

The index of the World Grouping whose World Cells you wish to get.

addCellsTo List<WorldCell>

The list to add the World Cells to. The list is not cleared automatically, so you will likely want to make sure it is empty before calling this method.


GetAllLoadedWorldCellsForWorldGrouping(int, List<WorldCell>)

public void GetAllLoadedWorldCellsForWorldGrouping(int groupingIndex, List<WorldCell> addCellsTo)

Adds all loaded World Cells across all Zones for the specified World Grouping to the passed in addCellsTo list.

Note that this method gets the currently loaded World Cells as contained in each Zone Grouping's internal dictionary. If a Zone Grouping is in the process of being updated, the World Cells' state cannot be predicted (they may be missing Asset Chunks, or those Asset Chunks may be in a state you do not expect, for example).

As such, it is usually best to call this method only when the World is not currently being updated, which you can check using the IsUpdateInProgress property.

However, the best approach for tracking World Cells is to use a World Grouping Listener, as you can be confident about the state of the World Cells (depending on which method you use for the tracking), and can accurately track when World Cells are added and removed.

World Cells returned via this method can be removed at a moments notice, so you should only make use of them for a very short period of time.

Parameters

Name Type Description
groupingIndex int

The index of the World Grouping whose World Cells you wish to get.

addCellsTo List<WorldCell>

The list to add the World Cells to. The list is not cleared automatically, so you will likely want to make sure it is empty before calling this method.


GetAllLoadedWorldCellsInZone(int, List<WorldCell>)

public void GetAllLoadedWorldCellsInZone(int zoneIndex, List<WorldCell> addCellsTo)

Adds all loaded World Cells for the specified Zone (across all World Groupings) to the passed in addCellsTo list.

Note that this method gets the currently loaded World Cells as contained in the Grouping's internal dictionary. If the Grouping is in the process of being updated, the World Cells' state cannot be predicted (they may be missing Asset Chunks, or those Asset Chunks may be in a state you do not expect, for example).

As such, it is usually best to call this method only when the World is not currently being updated, which you can check using the IsUpdateInProgress property.

However, the best approach for tracking World Cells is to use a World Grouping Listener, as you can be confident about the state of the World Cells (depending on which method you use for the tracking), and can accurately track when World Cells are added and removed.

World Cells returned via this method can be removed at a moments notice, so you should only make use of them for a very short period of time.

If the World has not been initialized, nothing will be added to the list.

Parameters

Name Type Description
zoneIndex int

The index of the Zone whose World Cells you wish to get.

addCellsTo List<WorldCell>

The list to add the World Cells to. The list is not cleared automatically, so you will likely want to make sure it is empty before calling this method.


GetAllZonesWithinRangeOfPosition(ICollection<InRangeZone>, Vector3Double, double)

public void GetAllZonesWithinRangeOfPosition(ICollection<InRangeZone> inRangeZones, Vector3Double position, double range)

Gets all Zones in range of the position, where range is the passed in value. This is a highly efficient method that uses a Bounding Volume Hierarchy type structure under the hood to efficiently sort the Zones into discreet areas for faster identification of in range zones.

Whether the Zone is in range is based on that Zones bounding volume within the World. Because a Zone can have variable sized Streamable Grids across different World Groupings, this bounding volume's max position is based on the largest Streamable Grid in the zone. This means that although a Zone may be within range to the position, an individual Zone Grouping may not actually be in range.

On the other hand, if the input position is less than the Zone's min position on all three axes, all Zone Groupings will be in range if the Zone is in range, since the min position of each Zone Grouping is equal to the Zone's min position.

Check each InRangeZone's AllZoneGroupingsGauranteedToBeInRange value to see if this latter case has occured. If AllZoneGroupingsGauranteedToBeInRange is true, you do not need to do anything else. All Zone Groupings for the Zone will be in range. If AllZoneGroupingsGauranteedToBeInRange is false, you will need to perform a more precise check for each Zone Grouping you care about, which you can do using the IsZoneGroupingWithinRangeOfPosition method. Pass in each Zone's ZonePosition (found on each inRangeZone object).

Finally, it is VERY IMPORTANT to note that when using an endless/repeating World, the same Zone can be added multiple times using this method, as the method will take into account whether the World has been repeated on each axis. If it has, the Zone's position may fall in the repeated portion of the World rather than the original unrepeated portion. In these cases, the RepeatedWorldIndices value on each InRangeZone will tell you if the zone is from a repeated portion of the World (0 means it falls on an unrepeated section, while +/- values indicate it falls on a repeated section - for example +1 means it is on the first repeated portion on the + axis in relation to the original/unrepeated portion).

Since the player can travel freely on each each axis, note that the Row, Column, and/or Layer value for the RepeatedWorldIndices may be different. If not using any repeating/endless axes, RepeatedWorldIndices will always be equal to Cell.Zero.

Parameters

Name Type Description
inRangeZones ICollection<InRangeZone>

All Zones that are within range. See the summary for more information/caveats.

Note that collection is cleared automatically when the method is called, so you should store the results from earlier calls if you don't want to lose that information.

position Vector3Double

The reference position that each Zone needs to be within range to.

range double

The range that a zone needs to be within to be added to inRangeZones.

Exceptions

Type Condition
Thrown when this method is called before the World has been initialized.

GetAllZonesWithinRangeOfPositionUsingTheoreticalOriginCell(ICollection<InRangeZone>, Vector3Double, double, Cell)

public void GetAllZonesWithinRangeOfPositionUsingTheoreticalOriginCell(ICollection<InRangeZone> inRangeZones, Vector3Double position, double range, Cell theoreticalOriginCell)

Gets all Zones in range of the position, but with the World projected using the passed in theoreticalOriginCell, where range is the passed in value. This is a highly efficient method that uses a Bounding Volume Hierarchy type structure under the hood to efficiently sort the Zones into discreet areas for faster identification of in range zones.

Whether the Zone is in range is based on that Zones bounding volume within the World. Because a Zone can have variable sized Streamable Grids across different World Groupings, this bounding volume's max position is based on the largest Streamable Grid in the zone. This means that although a Zone may be within range to the position, an individual Zone Grouping may not actually be in range.

On the other hand, if the input position is less than the Zone's min position on all three axes, all Zone Groupings will be in range if the Zone is in range, since the min position of each Zone Grouping is equal to the Zone's min position.

Check each InRangeZone's AllZoneGroupingsGauranteedToBeInRange value to see if this latter case has occured. If AllZoneGroupingsGauranteedToBeInRange is true, you do not need to do anything else. All Zone Groupings for the Zone will be in range. If AllZoneGroupingsGauranteedToBeInRange is false, you will need to perform a more precise check for each Zone Grouping you care about, which you can do using the IsZoneGroupingWithinRangeOfPosition method. Pass in each Zone's ZonePosition (found on each inRangeZone object).

Finally, it is VERY IMPORTANT to note that when using an endless/repeating World, the same Zone can be added multiple times using this method, as the method will take into account whether the World has been repeated on each axis. If it has, the Zone's position may fall in the repeated portion of the World rather than the original unrepeated portion. In these cases, the RepeatedWorldIndices value on each InRangeZone will tell you if the zone is from a repeated portion of the World (0 means it falls on an unrepeated section, while +/- values indicate it falls on a repeated section - for example +1 means it is on the first repeated portion on the + axis in relation to the original/unrepeated portion).

Since the player can travel freely on each each axis, note that the Row, Column, and/or Layer value for the RepeatedWorldIndices may be different. If not using any repeating/endless axes, RepeatedWorldIndices will always be equal to Cell.Zero.

Parameters

Name Type Description
inRangeZones ICollection<InRangeZone>

All Zones that are within range. See the summary for more information/caveats.

Note that collection is cleared automatically when the method is called, so you should store the results from earlier calls if you don't want to lose that information.

position Vector3Double

The reference position that each Zone needs to be within range to.

range double

The range that a zone needs to be within to be added to inRangeZones.

theoreticalOriginCell

The one based theoretical origin cell.

Exceptions

Type Condition
Thrown when this method is called before the World has been initialized.

GetAxesTypeUsedByWorldGrouping(int)

public Axes GetAxesTypeUsedByWorldGrouping(int groupingIndex)

Gets the Axes Type used by a particular World Grouping. This just finds the First Streamable Grid for the Grouping across all Zones, and returns its Axes type. This is only possible because all Streamable Grids for a World Grouping must have the same Axes type across all Zones.

Parameters

Name Type Description
groupingIndex int

The index of the World Grouping.

Returns

Axes
The Axes type of the World Grouping.

Exceptions

Type Condition
Thrown if no Streamable Grids have been assigned to this World Grouping (across all Zones).

GetBoundsOfEndlessGridCell(Cell, int, int)

public Bounds GetBoundsOfEndlessGridCell(Cell endlessGridCell, int zoneIndex, int groupingIndex)

Get the bounds of an Endless Grid Cell (can be any value).

Parameters

Name Type Description
endlessGridCell Cell

The Endless Grid Cell whose bounds should be retrieved.

zoneIndex int

The index of the Zone which contains the Endless Grid Cell in question.

groupingIndex int

The index of the World Grouping which contains the Endless Grid Cell in question.

Returns

Bounds
The bounds of the cell.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetChunkManagerAndUserID(int, int, int, out ChunkManager, out int)

public void GetChunkManagerAndUserID(int zoneIndex, int groupingIndex, int LOD, out ChunkManager chunkManager, out int managerUserID)

Gets the Chunk Manager and User ID for the given LOD Group on the given Zone Grouping. It is very unlikely you will need to access the Manager for any reason, as SAM already automates all of the interactions with it. In fact, it is discouraged that you interact with it.

Note that while all LOD Groups of the same "level" across the same World Grouping will use the same Chunk Manager no matter if they are within the same Zone, each LOD Group will have a unique managerUserID, as each is considered a separate user by the Manager.

Parameters

Name Type Description
zoneIndex int

The index of the Zone.

groupingIndex int

The index of the World Grouping.

LOD int

The LOD whose Chunk Manager you are interested in.

chunkManager ChunkManager

The Chunk Manager used by the LOD that will be set once the method completes.

managerUserID int

The manager ID for the LOD that will be set once the method completes. This is required to pass in for most methods of Chunk Managers.


GetChunkStreamerAndID(int, int, int, out ChunkStreamer, out int)

public void GetChunkStreamerAndID(int zoneIndex, int groupingIndex, int LOD, out ChunkStreamer ChunkStreamer, out int streamerUserID)

Gets the Chunk Streamer and User ID for the given LOD Group on the given Zone Grouping. It is very unlikely you will need to access the Streamer for any reason, as SAM already automates all of the interactions with it. In fact, it is discouraged that you interact with it. This method primarily exist to be used by the Addressable Prefab and Scene Streamer, however if you need to use it for some other reason, you can.

Note that while all LOD Groups of the same "level" across the same World Grouping will use the same Chunk Streamer no matter if they are within the same Zone, each LOD Group will have a unique streamerUserID, as each is considered a separate user by the Streamer.

Parameters

Name Type Description
zoneIndex int

The index of the Zone.

groupingIndex int

The index of the World Grouping.

LOD int

The LOD whose Chunk Streamer you are interested in.

ChunkStreamer ChunkStreamer

The Chunk Streamer used by the LOD that will be set once the method completes.

streamerUserID int

The ID that was assigned to the LOD Group when it registered with the Streamer. This is required for most methods of Chunk Streamers.


GetDimensionsOfEndlessGridCell(Cell, int, int)

public CellDimensions GetDimensionsOfEndlessGridCell(Cell endlessGridCell, int zoneIndex, int groupingIndex)

Get the cell dimensions of an Endless Grid Cell (can be any value).

Parameters

Name Type Description
endlessGridCell Cell

The Endless Grid Cell whose dimensions should be retrieved.

zoneIndex int

The index of the Zone which contains the Endless Grid Cell in question.

groupingIndex int

The index of the World Grouping which contains the Endless Grid Cell in question.

Returns

CellDimensions
The cell dimensions of the cell.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetEndlessGridCellsInAxisAlignedBoundingCube(int, Vector3Double, Vector3Double, List<CellAndIndex>)

public void GetEndlessGridCellsInAxisAlignedBoundingCube(int groupingIndex, Vector3Double min, Vector3Double max, List<CellAndIndex> endlessGridCellsInArea)

Gets all Endless Grid Cells on the indicated World Grouping that fall within an axis aligned bounding cube within the scene. This can be used to determine which cells fall within an area of the scene, such as within the Camera's view port (obviously it will be approximate, since the camera viewport is not a cube).

Unlike the GetWorldCellsInAxisAlignedBoundingCube method, this one deals with Endless Grid Cells rather than World Cells, so it is not concerned with what cells are currently loaded, but instead which cells (loaded or unloaded) fall within the given area.

If you need additional information about the cells you can query the World. For instance, if you want to know the dimensions of one of the cells, you can use the GetBoundsOfEndlessGridCell method.

Each cell is a CellAndIndex that contains the endless grid cell and the zone that cell is a part of. Since gaps can exist between Zones, it is possible that the bounding box does not overlap any cells!

In some cases you may only care about enabled endless grid cells. In these instances, you can pass in true for the onlyIncludeEnabledCells argument and all disabled cells will be filtered out of the list.

Parameters

Name Type Description
groupingIndex int

The World Grouping which contains the cells we care about. Only world cells from this World Grouping are added to the endlessGridCellsInArea list.

min Vector3Double

The lower left point on the cube.

max Vector3Double

The upper right point on the cube.

onlyIncludeEnabledCells bool

If true, only enabled cells will be included in the list.

endlessGridCellsInArea List<CellAndIndex>

The list which the endless grid cells will be added to. The method will not clear this list, so be cautious if it is not empty to begin with.

CellAndIndex is used in order that you can identify the Zone that each cell is in (Index property).

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetGroupingName_PreInitSafe(int)

public string GetGroupingName_PreInitSafe(int groupingIndex)

Gets the name of a World Grouping as set in the inspector.

Parameters

Name Type Description
groupingIndex int

The one based index of the World Grouping, as shown in the World's inspector.

Returns

string
The name of the Grouping (as set in the inspector).


GetIndexOfWorldGroupingUsingID_PreInitSafe(int)

public int GetIndexOfWorldGroupingUsingID_PreInitSafe(int groupingID)

Gets the current index of the World Grouping identified by the groupingID passed in.

Parameters

Name Type Description
groupingID int

The ID of the World Grouping.

Returns

int
The index of the World Grouping on this World (as shown in the inspector).


GetIndexOfZoneUsingID_PreInitSafe(int)

public int GetIndexOfZoneUsingID_PreInitSafe(int zoneID)

Gets the current index of the zone identified by the zoneID passed in.

Parameters

Name Type Description
zoneID int

The ID of the zone.

Returns

int
The index of the Zone on this World (as shown in the inspector), or -1 if a Zone with the input ID does not exist.


GetIndexOfZoneUsingName_PreInitSafe(string)

public int GetIndexOfZoneUsingName_PreInitSafe(string zoneName)

Gets the current index of the zone identified by the zoneName passed in. This method is slower than the version that uses the ID of the Zone, so it is recommended to use that instead when possible.

Parameters

Name Type Description
zoneName string

The name of the zone.

Returns

int
The index of the Zone on this World (as shown in the inspector), or -1 if a Zone does not exist with the input name.


GetLODGroupName(int, int, int)

public string GetLODGroupName(int zoneIndex, int groupingIndex, int lodIndex)

Gets the name of the LOD Group (specified by lodIndex) the Zone Grouping (specified by zoneIndex and groupingIndex) is currently configured to use. If no save data has been loaded or alt group names set via the PreInitialize method, and the World has not been initialized, this will return the Group Name specified for the LOD Group via the Streamable Grid asset.

Parameters

Name Type Description
zoneIndex int

The index of the Zone the Zone Grouping belongs to.

groupingIndex int

The index World Grouping the Zone Grouping belongs to.

lodIndex int

The index of the LOD the Group Name is being used with.

Returns

string
The Group Name of the LOD.


GetOriginCellOfZoneGrouping(int, int)

public Cell GetOriginCellOfZoneGrouping(int zoneIndex, int groupingIndex)

Gets the current Origin Cell of the Zone Grouping associated with the zoneIndex and groupingIndex. Each Origin Cell is the closest Endless Grid Cell to the Origin Position that belongs to the Zone Grouping.

Parameters

Name Type Description
zoneIndex int

The one based index of the Zone, as shown in the World's inspector.

groupingIndex int

The one based index of the World Grouping, as shown in the World's inspector.

Returns

Cell
The one based Origin Cell of the World Grouping.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetOriginCellPositionOfZoneGrouping(int, int)

public Vector3Double GetOriginCellPositionOfZoneGrouping(int zoneIndex, int groupingIndex)

Gets the current Origin Cell Position of the Zone Grouping. Note that the World's Origin Cell Position will be equal to either the position of the game object the World is on, or the position set in the World's inspector. The Origin Cell Position of Zone Groupings may be equal to this same position, or it may be different, as there is no gaurantee that a Cell from the Zone Grouping lines up perfectly with the Origin Cell. In these circumstances, SAM uses the closest Endless Grid Cell from the Zone Grouping (to the World's Origin Position).

Parameters

Name Type Description
zoneIndex int

The one based index of the Zone, as shown in the World's inspector.

groupingIndex int

The one based index of the World Grouping, as shown in the World's inspector.

Returns

Vector3Double
The Origin Cell position of the World Grouping.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetPositionAndDimensionsOfEndlessGridCell(Cell, int, int, out Vector3Double, out CellDimensions)

public void GetPositionAndDimensionsOfEndlessGridCell(Cell endlessGridCell, int zoneIndex, int groupingIndex, out Vector3Double positionOfCell, out CellDimensions dimensionsOfCell))

Retrieves the position and dimensions of an Endless Grid Cell.

Parameters

Name Type Description
endlessGridCell Cell

The Endless Grid Cell whose position and dimensions should be retrieved.

zoneIndex int

The index of the Zone which contains the Endless Grid Cell in question.

groupingIndex int

The index of the World Grouping which contains the Endless Grid Cell in question.

positionOfCell Vector3Double

The position of the cell (will be set when the method returns).

dimensionsOfCell CellDimensions

The cell dimensions of the cell (will be set when the method returns).

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetPositionOfEndlessGridCellUsingInitialOriginCell(Cell, int, int)

public Vector3Double GetPositionOfEndlessGridCellUsingInitialOriginCell(Cell endlessGridCell, int zoneIndex, int groupingIndex)

Gets the position of an Endless Grid Cell as if the Origin Cell of the World were still the initial Origin Cell (as set in the inspector of your World).

Note that the Endless Grid Cell is in reference to the World Grouping you specify via groupingIndex, but the Origin Cell is always in reference to the Base Grouping (Grouping 1).

Parameters

Name Type Description
endlessGridCell Cell

The Endless Grid Cell whose position will be returned.

zoneIndex int

The index of the Zone which contains the Endless Grid Cell in question.

groupingIndex int

The index of the World Grouping which contains the Endless Grid Cell in question.

Returns

Vector3Double
The position of the Endless Grid Cell.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetPositionOfEndlessGridCellUsingTheoreticalOriginCell(Cell, Cell, int, int)

public Vector3Double GetPositionOfEndlessGridCellUsingTheoreticalOriginCell(Cell endlessGridCell, Cell theoreticalOriginCell, int zoneIndex, int groupingIndex)

Gets the position that an Endless Grid Cell would be at if the Origin Cell of the Base Grouping/World were set to a theoreticaly Origin Cell.

Note that the Endless Grid Cell is in reference to the World Grouping you specify via groupingIndex, but the Origin Cell is always in reference to the Base Grouping.

Parameters

Name Type Description
endlessGridCell Cell

The Endless Grid Cell whose (theoretical) position will be returned.

theoreticalOriginCell Cell

The theoretical Origin Cell to base the Endless Grid cells position on.

zoneIndex int

The index of the Zone which contains the Endless Grid Cell in question.

groupingIndex int

The index of the World Grouping which contains the Endless Grid Cell in question.

Returns

Vector3Double
The (theoretical) position of the Endless Grid Cell.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetPositionOfEndlessGridCell_PreInitSafe(Cell, int, int)

public Vector3Double GetPositionOfEndlessGridCell_PreInitSafe(Cell endlessGridCell, int zoneIndex, int groupingIndex)

Retrieves the position of an Endless Grid Cell on a Zone Grouping. Unlike Streamable Grid cells, the indexes of this cell can be any value.

This method is safe to use at runtime before the World has been initialized. It is NOT SAFE to use outside of the editor!

The method uses the current World Origin Cell in its calculation. If SAM has not been initialized, this should be the Origin Cell set in the inspector, unless you call the method after loading save data.

Parameters

Name Type Description
endlessGridCell Cell

The cell whose position should be retrieved.

zoneIndex int

The index of the Zone which contains the Endless Grid Cell in question.

groupingIndex int

The index of the World Grouping which contains the Endless Grid Cell in question.

Returns

Vector3Double
The position of the cell.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetRowAndLayerPositionOfCell(Vector3Double, int, int, out double, out double)

public void GetRowAndLayerPositionOfCell(Vector3Double cellPosition, int zoneIndex, int groupingIndex, out double rowPosition, out double layerPosition)

Get the row and layer position of a Cell (can be a World Cell, Endless Grid Cell, or Streamable Grid Cell) given it position in the scene. This is useful because the row and layer positions may be using the y or z components of the Vector3Double, depending on the Axes set on the World Grouping's Streamable Grid.

When the Axes are set to Two_Dimensional_On_XZ_Axes or Three_Dimensional, the row position uses the z component and layer position uses y component of cellPosition.

When the Axes are set to Two_Dimensional_On_XY_Axes the row position uses y component and layer position uses the z component of cellPosition.

Parameters

Name Type Description
cellPosition Vector3Double

The world space position of the cell.

zoneIndex int

The index of the Zone which contains the Endless Grid Cell in question.

groupingIndex int

The index of the World Grouping which contains the cell whose row and layer position we want to extract from input position.

rowPosition double

The position of the cell's row (will be set after this method returns).

layerPosition double

The position of the cell's layer (will be set after this method returns).

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetStreamableGridOfZoneGrouping_PreInitSafe(int, int)

public StreamableGrid GetStreamableGridOfZoneGrouping_PreInitSafe(int zoneGrouping, int groupingIndex)

Gets the Streamable Grid associated with a specific Zone Grouping.

Parameters

Name Type Description
zoneIndex int

The index of the Zone that contains the Streamable Grid you are trying to get.

groupingIndex int

The World Grouping whose Streamable Grid you are trying to get.

Returns

StreamableGrid
The Streamable Grid associated with the World Grouping.


GetWorldCellsInAxisAlignedBoundingCube(int, Vector3Double, Vector3Double, List<WorldCell>)

public void GetWorldCellsInAxisAlignedBoundingCube(int groupingIndex, Vector3Double min, Vector3Double max, List<WorldCell> worldCellsInArea)

Gets all World Cells on the indicated World Grouping that fall within an axis aligned bounding cube within the scene. This can be used to determine which cells fall within an area of the scene, such as within the Camera's view point (obviously it will be approximate, since the camera viewport is not a cube).

Unlike the other GetWorldCellsInAxisAlignedBoundingCube method, this one is LOD agnostic. All World Cells belonging to the World Grouping will be added to the list, regardless of which LOD they have in use (so long as they fall within the cube's area).

Also note that this method is Zone agnostic. Cells will be returned so long as they are associated with the input World Grouping, no matter which Zone they fall within.

Parameters

Name Type Description
groupingIndex int

The World Grouping which contains the cells we care about. Only world cells from this World Grouping are added to the worldCellsInArea list.

min Vector3Double

The lower left point on the cube.

max Vector3Double

The upper right point on the cube.

worldCellsInArea List<WorldCell>

The list which the world cells will be added to. The method will not clear this list, so be cautious if it is not empty to begin with.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetWorldCellsInAxisAlignedBoundingCube(int, int, Vector3Double, Vector3Double, List<WorldCell>)

public void GetWorldCellsInAxisAlignedBoundingCube(int groupingIndex, int LOD, Vector3Double min, Vector3Double max, List<WorldCell> worldCellsInArea)

Gets all World Cells on the indicated World Grouping and LOD that fall within an axis aligned bounding cube within the scene. This can be used to determine which cells fall within an area of the scene, such as within the Camera's view point (obviously it will be approximate, since the camera viewport is not a cube).

Parameters

Name Type Description
groupingIndex int

The World Grouping which contains the cells we care about. Only world cells from this World Grouping are added to the worldCellsInArea list.

LOD int

The LOD whose cells we care about. Only world cells that are part of this LOD will be added to the worldCellsInArea list.

min Vector3Double

The lower left point on the cube.

max Vector3Double

The upper right point on the cube.

worldCellsInArea List<WorldCell>

The list which the world cells will be added to. The method will not clear this list, so be cautious if it is not empty to begin with.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetWorldCellsPositionIsIn(Vector3Double, int, List<WorldCell>)

public bool GetWorldCellsPositionIsIn(Vector3Double position, int groupingIndex, List<WorldCell> worldCells)

Gets any and all World Cells that the position is in for the specified World Grouping, across all Zones. If no World Cells can be identified, the input worldCells list will be empty.

Parameters

Name Type Description
position Vector3Double

The position in world space. Note that for 2D World Groupings, the position on the third unused axis is still taken into account with this method, and the position must fall within the dimensions of the single Layer of the Zone Grouping.

groupingIndex int

The index of the World Grouping which contains the World Cells in question.

worldCells List<WorldCell>

When this method returns, will contain the World Cells that contain the position, if any, across all zones, but only for world cells associated with the input groupingIndex.

Returns

bool
A bool indicating whether the World Cell was able to be retrieved.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetWorldRegionName(int)

public string GetWorldRegionName(int worldRegionNumber)

Gets the name of the World Region whose number in the World inspector matches the worldRegionNumber passed in. For performance reasons this method does not do any error checking, therefore please be absolutely sure that the number passed in is valid (not less than 1 and not greater than the number of World Regions on this world).

Parameters

Name Type Description
worldRegionNumber int

The number of the World Region whose name you want to retrieve (you can find this number in the World Inspector, before each World Region Name).

Returns

string
The name of the World Region.


GetWorldRegionOriginCell(int)

public Cell GetWorldRegionOriginCell(int worldRegionNumber)

Gets the one based Origin Cell of the World Region whose number in the World inspector matches the worldRegionNumber passed in. For performance reasons this method does not do any error checking, therefore please be absolutely sure that the number passed in is valid (not less than 1 and not greater than the number of World Regions on this world).

Parameters

Name Type Description
worldRegionNumber int

The number of the World Region whose Origin Cell you want to retrieve (you can find this number in the World Inspector, before each World Region Name).

Returns

Cell
The Origin Cell of the World Region.


GetZoneGroupingNeighbors(int, int, int[])

public void GetZoneGroupingNeighbors(int zoneIndex, int groupingIndex, int[] neighborZones)

Parameters

Name Type Description
zoneIndex int

Description

groupingIndex int

Description

neighborZones int[]

The indices of the Zones which are neighboring the input Zone Grouping. Must be initialized to a length of 6 before calling the method, or else an exception will be thrown!

Each index stores the Index of a neighboring Zone (as shown in the inspector), or 0 if there is no neighbor in that direction..

West/East refer to the -/+ X Axis respectively, while North/South refers to either the Z -/+ or Y -/+ Axis respectively (depending on the Axes Type of the underlying Streamable Grid of the input Zone Grouping). Bottom/Top is only used for 3D Zone Groupings (and thus will be set to 0 for 2D Axes), and always refers to the Y -/+ Axis respectively.

Index 0 is the West Neighbor.
Index 1 is the North Neighbor.
Index 2 is the East Neighbor.
Index 3 is the South Neighbor.
Index 4 is the Bottom Neighbor.
Index 5 is the Top Neighbor.

This array can be reused for repeated calls to stop memory from being created each time it is called.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

GetZoneName_PreInitSafe(int)

public string GetZoneName_PreInitSafe(int zoneIndex)

Gets the name of a Zone as assigned in the World inspector.

Parameters

Name Type Description
zoneIndex int

The index of the Zone.

Returns

string
The name of the Zone.


IsZoneEnabled(int)

public bool IsZoneEnabled(int zoneIndex)

Returns whether a Zone is enabled (as set via the inspector).

Parameters

Name Type Description
zoneIndex int

The index of the Zone, as shown in the inspector.

Returns

bool
True if the zone is enabled, false otherwise.


IsZoneGrouping3D_PreInitSafe(int, int)

public bool IsZoneGrouping3D_PreInitSafe(int zoneIndex, int groupingIndex)

Can be used to query whether a particular Zone Grouping is three dimensional (it's Streamable Grid uses the Three_Dimensional Axes type). This method will throw an exception if no Streamable Grid has been assigned to the Zone Grouping!

Parameters

Name Type Description
zoneIndex int

The index of the Zone to query.

groupingIndex int

The index of the World Grouping to query.

Returns

bool
True if the World Grouping is 3D, false otherwise.


IsZoneGroupingEnabled_PreInitSafe(int, int)

public bool IsZoneGroupingEnabled_PreInitSafe(int zoneIndex, int groupingIndex)

Checks whether a Zone Grouping is enabled. Can be used when you know the Zone Index and Grouping Index of a Zone Grouping, but do not know if a Streamable Grid has been assigned to the Zone for the particular World Grouping, or whether the Zone has been disabled via the inspector.

Parameters

Name Type Description
zoneIndex int

The index of the Zone.

groupingIndex int

The index of the World Grouping.

Returns

bool
True if a Streamable Grid has been assigned to the Zone for the input Grouping and the Zone is enabled (via the inspector), false otherwise. Also false if the World has not been initialized.


IsZoneGroupingUpdatingCells(int, int)

public bool IsZoneGroupingUpdatingCells(int zoneGrouping, int grouping)

Queries the World to determine if the given Zone Grouping is currently performing an update to its collection of World Cells. Generally speaking, methods that retrieve World Cells from this World should only be performed for Zone Groupings that this method returns false for. Otherwise, the cell you are trying to retrieve may have been removed from the Worlds internal collection of cells, even though it still 'appears' in the scene, or the cell may have not been fully loaded yet, meaning the cell is retrievable even though it might not 'appear' in the scene. When the value returns true, it means all cells belonging to the given Zone Grouping that exist in the internal collection of cells are in their correct state, and all cells appearing in the scene are correctly contained within the World's internal collection of cells.

Rather than retrieving World Cells directly from the World, however, we recommend using World Grouping Listeners, as you can be more assured of the World Cells' status.

Parameters

Name Type Description
zoneIndex int

The index of the Zone to run the query on.

groupingIndex int

The index of the World Grouping to run the query on.

Returns

bool
See summary above.


IsZoneGroupingWithinRangeOfPosition(int, int, Vector3Double, double, Vector3Double)

public bool IsZoneGroupingWithinRangeOfPosition(int zoneIndex, int groupingIndex, Vector3Double position, double range, Vector3Double zoneGroupingPosition)

Checks whether a reference position is within range of the input Zone Grouping.

This method is intended to be used after calling GetAllZonesWithinRangeOfPosition or GetAllZonesWithinRangeOfPositionUsingTheoreticalOriginCell, for any InRangeZone's that were found with AllZoneGroupingsGauranteedToBeInRange set to false. It verifies that a Zone Grouping is actually In Range to the same reference position passed to GetAllZonesWithinRangeOfPosition, since when AllZoneGroupingsGauranteedToBeInRange is false, there is no gaurantee that each Zone Grouping in the Zone is actually in range.

This is why this method takes the zoneGroupingPosition as input, as that position is provided to the InRangePosition object when calling the methods listed above. Also note that you do not need to provide any Origin Cell when calling this method, because this method only uses the zoneGroupingPosition passed in to determine whether the position is within range. So if you used GetAllZonesWithinRangeOfPositionUsingTheoreticalOriginCell, the zoneGroupingPosition has already been calculated as if the Origin Cell were set to the origin cell you passed into that method.

Parameters

Name Type Description
zoneIndex int

The Zone Index of the Zone Grouping.

groupingIndex int

The World Grouping Index of the Zone Grouping.

position Vector3Double

The reference position that the Zone Grouping needs to be within range to.

range double

The defined range that the Zone Grouping needs to be within.

zoneGroupingPosition Vector3Double

The current scene position of the Zone Grouping.

Returns

bool
True if the Zone Grouping is in range of the position, false otherwise.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

LoadWorldRegion(int, bool, bool)

public void LoadWorldRegion(int worldRegionNumber, bool changeOriginCell, bool clearLoadedWorldRegions)

Loads the World Region matching the input worldRegionNumber.

This method will not give you any insight into when the cells are actually loaded. If you need to know when the World has processed the World Region and updated itself to reflect changes resulting from the World Region being loaded, you can register a callback method with the World via the RegisterOnUserRequestsFulfilledCallback method. The callback method will be invoked once the World has completed an update cycle containing changes that resulted from the load operation.

This strategy also allows you to load and unload multiple regions in one World Update cycle, and be notified when all regions are loaded and/or unloaded. To do so, simply call the LoadWorldRegion and UnloadWorldRegion methods for each region that you want to load or unload before calling the WaitForUpdateThatIncludesRequests method (all must be called in the same frame).

Parameters

Name Type Description
worldRegionNumber int

The number of the World Region to load (you can find this number in the World Inspector, before each World Region Name).

changeOriginCell bool

If true, an attempt will be made to set the Origin Cell of the World to the Origin Cell set in the World Region. If false, the Origin Cell will remain what it currently is. Note that while using this method, the change operation may fail for several different reasons.

In order to ensure the change is successful, you should query the IsExplicitOriginCellChangeBlocked property and ensure it is false before calling the method. If you decide to forsake this strategy and the change fails, a warning message will be printed to the console.

If the Origin Cell change can be changed, note that the actual change does not occur until the next natural World Update. Between this method call and the World Update, it is possible for the Origin Cell change to be overwritten if LoadWorldRegion, ChangeOriginCell, or some other methods that explicitly changes the Origin Cell are called.

clearLoadedWorldRegions bool

If true, any World Regions loaded previously (including auto-loaded ones) will be unloaded during the same World Update that loads the new World Region.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World has been initialized.
InvalidOperationException Thrown when the method is called while the World is in the process of being destroyed.
ArgumentException Thrown when worldRegionNumber is not valid.

LoadWorldRegion(string, bool, bool)

public void LoadWorldRegion(string worldRegionName, bool changeOriginCell, bool clearLoadedWorldRegions)

Loads the World Region matching the input worldRegionName.

This method will not give you any insight into when the cells are actually loaded. If you need to know when the World has processed the World Region and updated itself to reflect changes resulting from the World Region being loaded, you can register a callback method with the World via the RegisterOnUserRequestsFulfilledCallback method. The callback method will be invoked once the World has completed an update cycle containing changes that resulted from the load operation.

This strategy also allows you to load and unload multiple regions in one World Update cycle, and be notified when all regions are loaded and/or unloaded. To do so, simply call the LoadWorldRegion and UnloadWorldRegion methods for each region that you want to load or unload before calling the WaitForUpdateThatIncludesRequests method (all must be called in the same frame).

Parameters

Name Type Description
worldRegionName string

The name of the World Region to load.

changeOriginCell bool

If true, an attempt will be made to set the Origin Cell of the World to the Origin Cell set in the World Region. If false, the Origin Cell will remain what it currently is. Note that while using this method, the change operation may fail for several different reasons.

In order to ensure the change is successful, you should query the IsExplicitOriginCellChangeBlocked property and ensure it is false before calling the method. If you decide to forsake this strategy and the change fails, a warning message will be printed to the console.

If the Origin Cell change can be changed, note that the actual change does not occur until the next natural World Update. Between this method call and the World Update, it is possible for the Origin Cell change to be overwritten if LoadWorldRegion, ChangeOriginCell, or some other methods that explicitly changes the Origin Cell are called.

clearLoadedWorldRegions bool

If true, any World Regions loaded previously (including auto-loaded ones) will be unloaded during the same World Update that loads the new World Region.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World has been initialized.
InvalidOperationException Thrown when the method is called while the World is in the process of being destroyed.
ArgumentException Thrown when worldRegionName is not valid.

PreInitialize_EnableWorldRegionAutoLoad(List<int>, bool)

public void PreInitialize_EnableWorldRegionAutoLoad(List<int> worldRegionNumbers, bool overwriteRegionsInPersistentData)

You can use this method to enable auto loading of World Regions so that they are loaded when the World is initialized (this is in addition to any Regions that have Auto Load enabled in the World's inspector).

Note that unlike the runtime LoadWorldRegion methods, you cannot set clearLoadedWorldRegions since no World Regions are loaded at this point. The Origin Cell data in the World Regions will also be ignored when using this method, so you must use PreInitialize_SetOriginCell if you want to make use of this data.

This must be called before the World has been initialized.

Parameters

Name Type Description
worldRegionNumbers List<int>

The numbers of the World Regions to enable auto loading for (numbers are as shown in the World inspector).

overwriteRegionsInPersistentData bool

When the World's persistent data is saved, the World Regions that are currently loaded are saved with the data so that they can be autoamtically loaded when that data is loaded.

If you pass in true for this argument, the region data in the persistent data will be ingored (if persistent data is loaded).

>If you pass in false, when persistent data is loaded, only the World Regions found in the persistent data will be auto-loaded. Any other regions that you have configured to be auto-loaded with this method will not be auto-loaded!

If no persistent data is loaded, this value will have no effect.

Exceptions

Type Condition
InitializedSAMObjectException Thrown when this method is called after the World has been initialized.

PreInitialize_EnableWorldRegionAutoLoad(List<string>, bool)

public void PreInitialize_EnableWorldRegionAutoLoad(List<string> worldRegionNames, bool overwriteRegionsInPersistentData)

You can use this method to enable auto loading of World Regions so that they are loaded when the World is initialized (this is in addition to any Regions that have Auto Load enabled in the World's inspector).

Note that unlike the runtime LoadWorldRegion methods, you cannot set clearLoadedWorldRegions since no World Regions are loaded at this point. The Origin Cell data in the World Regions will also be ignored when using this method, so you must use PreInitialize_SetOriginCell if you want to make use of this data.

This must be called before the World has been initialized.

Parameters

Name Type Description
worldRegionNames List<string>

The names of the World Regions to enable auto loading for (names are as shown in the World inspector).

overwriteRegionsInPersistentData bool

When the World's persistent data is saved, the World Regions that are currently loaded are saved with the data so that they can be autoamtically loaded when that data is loaded.

If you pass in true for this argument, the region data in the persistent data will be ingored (if persistent data is loaded).

>If you pass in false, when persistent data is loaded, only the World Regions found in the persistent data will be auto-loaded. Any other regions that you have configured to be auto-loaded with this method will not be auto-loaded!

If no persistent data is loaded, this value will have no effect.

Exceptions

Type Condition
InitializedSAMObjectException Thrown when this method is called after the World has been initialized.

PreInitialize_SetActiveGameStartConfiguration(string)

public void PreInitialize_SetActiveGameStartConfiguration(string configurationName)

Allows you to switch the game start configuration that will be used when this World is initialized. The Game Start Configuration controls the starting position of players which are used by Active Grids synced to this World, as well as the Origin Cell the World will use at start. Combined, these settings control the layout of cells at the start of the game.

Note that if SAM persistent data is loaded, no game start configurations will not be used, as the data in the persistent save file will be used instead.

Parameters

Name Type Description
configurationName string

The name of the Game Start Configuration to use. Must match one of the configurations setup on the World, or you can pass in null or an empty string to disable all Game Start Configurations.

Exceptions

Type Condition
InitializedSAMObjectException Thrown when this method is called after the World has been initialized.

PreInitialize_SetGroupName(int, int, int, string, bool)

public void PreInitialize_SetGroupName(int zoneIndex, int groupingIndex, int lodIndex, string newGroupName, bool overwriteNameFromPersistentData)

Changes the Group Name of the specified World Grouping's LOD Group, allowing for the initial Asset Chunks that are loaded to be different than what they normally are.

The main use of this will be to implement custom loading rather than making use of the automatic IPersistentDataController class, if you need to save different data in different places (on the server, on a file on the users system, etc.). Note, if all your data is stored in the same place, you are better off using a custom class that derives from IPersistentDataController, and then set it up to save data to that location (as Group Name changes are automatically tracked and saved with persistent data).

This must be called before the World has been initialized.

Parameters

Name Type Description
zoneIndex int

The index of the Zone whose LOD Group Name you wish to modify.

groupingIndex int

The index of the World Grouping whose LOD Group Name you wish to modify.

lodIndex int

The index of the LOD Group on the World Grouping whose Group Name you wish to change.

newGroupName string

The new Group Name.

overwriteNameFromPersistentData bool

Should the new Group Name overwrite the Group Name found in persistent data for this World Grouping's LOD Group? Has no effect if no persistent data is loaded.

Exceptions

Type Condition
InitializedSAMObjectException Thrown when this method is called after the World has been initialized.
ArgumentException Thrown when gropuingIndex and/or lodIndex are not valid.
MissingComponentException Thrown if a Streamable Grid is not assigned to the specified World Grouping.

PreInitialize_SetGroupName(string, bool)

public void PreInitialize_SetGroupName(string newGroupName, bool overwriteNameFromPersistentData)

Changes the Group Name of Zone 1, Grouping 1's LOD Group 1, allowing for the initial Asset Chunks that are loaded to be different than what they normally are.

The main use of this will be to implement custom loading rather than making use of the automatic IPersistentDataController class, if you need to save different data in different places (on the server, on a file on the users system, etc.). Note, if all your data is stored in the same place, you are better off using a custom class that derives from IPersistentDataController, and then set it up to save data to that location (as Group Name changes are automatically tracked and saved with persistent data).

This must be called before the World has been initialized.

Parameters

Name Type Description
newGroupName string

The new Group Name.

overwriteNameFromPersistentData bool

Should the new Group Name overwrite the Group Name found in persistent data for Grouping 1's LOD Group 1? Has no effect if no persistent data is loaded.

Exceptions

Type Condition
InitializedSAMObjectException Thrown when this method is called after the World has been initialized.
MissingComponentException Thrown if a Streamable Grid is not assigned to the specified World Grouping.

PreInitialize_SetGroupNamesForAllLODGroupsOnWorldGrouping(int, int, string[], bool, bool)

public void PreInitialize_SetGroupNamesForAllLODGroupsOnWorldGrouping(int zoneIndex, int groupingIndex, string[] newGroupNames, bool ignoreNamesFromPersistentData, bool applyOverwriteRuleToNullNames)

Changes the Group Names of all LOD Groups on the specified Zone Grouping, allowing for the initial Asset Chunks that are loaded to be different than what they normally are.

If you only want to update some of the LOD's, set the names of LOD's that you don't want to update to null.

The main use of this will be to implement custom loading rather than making use of the automatic IPersistentDataController class, if you need to save different data in different places (on the server, on a file on the users system, etc.). Note, if all your data is stored in the same place, you are better off using a custom class that derives from IPersistentDataController, and then set it up to save data to that location (as Group Name changes are automatically tracked and saved with persistent data).

This must be called before the World has been initialized.

Parameters

Name Type Description
newGroupNames string[]

The new group names. Set individual indexes to null to avoid replacing that LOD Group's default/saved name.

ignoreNamesFromPersistentData bool

Should the new group names overwrite the group names found in persistent data for this World Grouping? Has no effect if no persistent data is loaded.

zoneIndex int

The index of the Zone whose LOD Group Names you wish to modify.

groupingIndex int

The index of the World Grouping whose LOD Group Names you wish to modify.

applyOverwriteRuleToNullNames bool

Should the value passed in for ignoreNamesFromPersistentData be applied to LOD Groups which you are not passing in names for (i.e., the indexes you have set to null in newGroupNames)?

Exceptions

Type Condition
InitializedSAMObjectException Thrown when this method is called after the World has been initialized.
ArgumentException Thrown when groupingIndex is not valid, or if the length of the newGroupNames array does not match the number of LOD Groups on the World Grouping specified.
MissingComponentException Thrown if a Streamable Grid is not assigned to the specified World Grouping.

PreInitialize_SetGroupNamesForZone(int, string[][], bool, bool)

public void PreInitialize_SetGroupNamesForZone(int zoneIndex, string[][] newGroupNames, bool ignoreNamesFromPersistentData, bool applyOverwriteRuleToNullNames)

Changes the Group Names of all LOD Groups on all World Groupings of the Zone specified, allowing for the initial Asset Chunks that are loaded to be different than what they normally are.

If you only want to update some of the LOD Groups, set the names of LOD Groups that you don't want to update to null (as Group Name changes are automatically tracked and saved with persistent data).

The main use of this will be to implement custom loading rather than making use of the automatic IPersistentDataController class, if you need to save different data in different places (on the server, on a file on the users system, etc.). Note, if all your data is stored in the same place, you are better off using a custom class that derives from IPersistentDataController, and then set it up to save data to that location (as Group Name changes are automatically tracked and saved with persistent data).

It is possible for a Zone to have some World Groupings not in use (by not supplying a Streamable Grid to it). When such a World Grouping is encountered, no Group Name changes will be applied to it, so it's typically a good idea to set those indexes in the array to null (via newGroupNames[someIndex] = null).

This must be called before the World has been initialized.

Parameters

Name Type Description
zoneIndex int

The index of the Zone whose Group Names you wish to modify.

newGroupNames string[][]

The new group names.

ignoreNamesFromPersistentData bool

Should the new group names overwrite the group names found in persistent data for this World? Has no effect if no persistent data is loaded.

applyOverwriteRuleToNullNames bool

Should the value passed in for ignoreNamesFromPersistentData be applied to LOD's which you are not passing in names for (i.e., the ones you have set to null in newGroupNames)?

Exceptions

Type Condition
InitializedSAMObjectException Thrown when this method is called after the World has been initialized.
ArgumentException Thrown when the length of the newGroupNames array does not match the number of World Groupings on this world, or one or more of the arrays within the main array do not match the number of LOD Groups for that World Grouping (i.e., newGroupNames[0].Length does not match the number of LODs on World Grouping 1 (remember, the 0th index stores World Grouping 1, index 1 stores World Grouping 2, etc.)
MissingComponentException Thrown if a Streamable Grid is not assigned to one of the World Groupings.

PreInitialize_SetOriginCell(Cell, bool)

public void PreInitialize_SetOriginCell(Cell newOriginCell, bool overwriteOriginCellFromPersistentData)

Changes the Origin Cell that this World will initially use. This must be called before the World has been initialized.

The Origin Cell set is the Origin Cell of the base World Grouping. There is no need to set the Origin Cell of each sub World Grouping, as they are automatically set based on the Origin Cell of the base World Grouping.

The main use of this will be to implement custom loading rather than making use of the automatic IPersistentDataController class, if you need to save different data in different places (on the server, on a file on the users system, etc.). Note, if all your data is stored in the same place, you are better off using a custom class that derives from IPersistentDataController, and then set it up to save data to that location (as Origin Cell changes are automatically tracked and saved with persistent data)..

For methods or features that utilize the starting Origin Cell to calculate data, this Origin Cell will not be used. Instead, the origin Origin Cell as set in the inspector of your World will be used. Such data might be used to calculate the total offset of current world from the original world. For instance, imagine you have a 2D world with 2k x 2k cells at origin 0,0 in the scene, whose starting Origin Cell was ow = 6, column = 6, but whose current Origin Cell is row = 8, column = 8. In order to calculate the total offset of the world, we need to know that cell 6,6 is the starting Origin Cell and is currently positioned at -4000, -4000. Therefore, the total offset of the world is -4000, -4000. This is handy to know when dealing with 3rd party tools that utilize a root transform to track how much the world has been offset.

This must be called before the World has been initialized.

Parameters

Name Type Description
newOriginCell Cell

The new Origin Cell.

Note, this Origin Cell is 1 based, i.e., the bottom left most cell of the world has an index of row = 1, column = 1, and layer = 1 (for 3D worlds). The Origin Cell in the save data, on the other hand, is 0 based.

Also note the layer is only used if the Streamable Grid is Three Dimensional.

overwriteOriginCellFromPersistentData bool

Should the new Origin Cell overwrite the Origin Cell found in persistent data for this World? Has no effect if no persistent data is loaded.

Exceptions

Type Condition
InitializedSAMObjectException Thrown when this method is called after the World has been initialized.

PreInitialize_SetWorldOrigin(Vector3Double, bool)

public void PreInitialize_SetWorldOrigin(Vector3Double newWorldOrigin, bool overwriteWorldOriginFromPersistentData)

Changes the World's Origin Position.

This is the only way to change the World Origin position. Once the World is initialized, it's position cannot be modified.

This must be called before the World has been initialized.

Parameters

Name Type Description
newWorldOrigin Vector3Double

The new world origin.

overwriteWorldOriginFromPersistentData bool

Should the new world origin overwrite the world origin found in persistent data for this World? Has no effect if persistent data is not loaded.

Exceptions

Type Condition
InitializedSAMObjectException Thrown when this method is called after the World has been initialized.

PreInitialize_TryGetActiveGameStartConfiguration(out string, out Cell, out Vector3)

public bool PreInitialize_TryGetActiveGameStartConfiguration(out string configurationName, out Cell configurationStartingOriginCell, out Vector3 configurationStartingPlayerPosition)

Attempts to get information about the Active Game Start Configuration for this World. The method will return false if there is no Active Configuration, in which case the out arguments should not be used.

Parameters

Name Type Description
configurationName out string

The name of the Active Game Start Configuration.

configurationStartingOriginCell out Cell

The Starting Origin Cell stored in the Active Game Start Configuration.

configurationStartingPlayerPosition out Vector3

The Starting Player Position stored in the Active Game Start Configuration.

Returns

bool
True if a Game Start Configuration is active on this World, false otherwise.

Exceptions

Type Condition
InitializedSAMObjectException Thrown when this method is called after the World has been initialized.

Register(IWorldUser, out int)

public void Register(IWorldUser user, out int registrationID)

Register an IWorldUser user with the World. Users may register in order to receive callbacks when the Origin Cell is changed or clamped, when the World is destroyed, or if they need to delay Origin Cell changes. See the IWorldUser page for more information.

Parameters

Name Type Description
user IWorldUser

The user to register.

registrationID int

An ID that is assigned to the user upon registration. You must store this ID so that you can pass it into the DeRegister method later (if you plan on de-registering as a World User).


RegisterOnUserRequestsFulfilledCallback(Action<World>)

public void RegisterOnUserRequestsFulfilledCallback(Action<World> OnRequestsFulfilledCallback)

You can use this method to register a callback method that will be invoked after any outside requests to add/remove users (including loading/unloading World Regions) or change the Origin Cell have been fulfilled by the World. Basically, once a World Updated is completed that has taken into account the requests or Origin Cell change, the callback will be invoked.

In order to use the method for that use case, it is imperative that you call this method immediately after sending in all add/remove requests (using AddCellUsers and RemoveCellUsers), load world region calls, or change the Origin Cell, within the same frame. Otherwise there is no gaurantee that the method will be able to track the update that includes those requests.

When used correctly, the callback will only be invoked once a World update including the add/remove requests and/or origin cell change has been run, or after processing the add/remove requests and the World determines no World Update is needed.

This use case is also a replacement for the AddCellUsersAndWaitForChunksToBeLoaded and RemoveChunksAndWaitForChunksToBeUnloaded methods that were previously present.

Parameters

Name Type Description
OnRequestsFulfilledCallback Action<World>

The callback that will be invoked once the requests have been fulfilled.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

RemoveCellUsers(IList<Cell>, int, int, int)

public void RemoveCellUsers(IList<Cell> cells, int zoneIndex, int groupingIndex, int lodIndex)

Sends in a request to remove users from the list of specified cells. This method should only be used by advanced users, as in 99% of cases you should let the Active Grid class control the removal of cell users. If you do decide to use this method, keep the following in mind:

The World tallies all user requests (either add or remove) for World Cells. If the Active Grid sends in an add requests for a specific cell, then you send in an add requests for the same cell, a tally of 2 will exists for the cell. The cell is then loaded and will not be unloaded until the tally reaches 0. In this way, multiple users can lay claim to a cell, and rather than loading that cell multiple times, it is only loaded once.

This strategy introduces errors if you do not keep track of the users you have added to a cell, however. For every user you add, you will typically want to remove a user for the same cell at a later date. If you do not, the cell will likely never be unloaded.

Parameters

Name Type Description
cells IList<Cell>

The list of cells to remove users from.

zoneIndex

The index of the Zone the cells are associated with.

groupingIndex int

The index of the World Grouping to remove cell users for.

lodIndex int

The index of the LOD to remove cells users for.

Returns

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

Exceptions

Type Condition
UninitializedSAMObjectException Thrown if the method is called before the World has been initialized.
InvalidOperationException Thrown if the method is called while the world is in the process of being destroyed.
ArgumentException Thrown if the groupingIndex or lodIndex passed in are invalid.

RemoveCellUsers(IList<LODCell>, int, int)

public void RemoveCellUsers(IList<LODCell> cells, int zoneIndex, int groupingIndex)

Sends in a request to remove users from the list of specified cells in the form of LODCells. This method should only be used by advanced users, as in 99% of cases you should let the Active Grid class control the removal of cell users. If you do decide to use this method, keep the following in mind:

The World tallies all user requests (either add or remove) for World Cells. If the Active Grid sends in an add requests for a specific cell, then you send in an add requests for the same cell, a tally of 2 will exists for the cell. The cell is then loaded and will not be unloaded until the tally reaches 0. In this way, multiple users can lay claim to a cell, and rather than loading that cell multiple times, it is only loaded once.

This strategy introduces errors if you do not keep track of the users you have added to a cell, however. For every user you add, you will typically want to remove a user for the same cell at a later date. If you do not, the cell will likely never be unloaded.

Parameters

Name Type Description
cells IList<LODCell>

The list of cells to remove users from.

zoneIndex

The index of the Zone the cells are associated with.

groupingIndex int

The index of the World Grouping to remove cell users for.

Returns

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

Exceptions

Type Condition
UninitializedSAMObjectException Thrown if the method is called before the World has been initialized.
InvalidOperationException Thrown if the method is called while the world is in the process of being destroyed.
ArgumentException Thrown if the groupingIndex passed in is invalid.

RemoveCellUsers(IList<WorldGroupingCell>)

public void RemoveCellUsers(IList<WorldGroupingCell> cells)

Sends in a request to remove users from the list of specified cells, in the form of WorldGroupingCells. This method should only be used by advanced users, as in 99% of cases you should let the Active Grid class control the removal of cell users. If you do decide to use this method, keep the following in mind:

The World tallies all user requests (either add or remove) for World Cells. If the Active Grid sends in an add requests for a specific cell, then you send in an add requests for the same cell, a tally of 2 will exists for the cell. The cell is then loaded and will not be unloaded until the tally reaches 0. In this way, multiple users can lay claim to a cell, and rather than loading that cell multiple times, it is only loaded once.

This strategy introduces errors if you do not keep track of the users you have added to a cell, however. For every user you add, you will typically want to remove a user for the same cell at a later date. If you do not, the cell will likely never be unloaded.

Please note, to save on performance, no error checking is done on the passed in Zone Indexes, World Grouping or LOD indexes, so please be sure that those values are valid!

Parameters

Name Type Description
cells IList<WorldGroupingCell>

The list of cells to remove users from.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown if the method is called before the World has been initialized.
InvalidOperationException Thrown if the method is called while the world is in the process of being destroyed.

RemoveWorldGroupingListener(IWorldGroupingListener, int)

public void RemoveWorldGroupingListener(IWorldGroupingListener groupingListener, int groupingIndex)

Removes the IWorldGroupingListener from the World Grouping indicated by groupingIndex. Listeners are added/removed on a per Grouping basis, not a per Zone Grouping basis, so when you add/remove a listener for a World Grouping, all Zones that contain a valid Streamable Grid for that Grouping will have the listener added/removed.

Removing Listeners can only be achieved after the World has been initialized. You can use this to remove either runtime added Listeners or Listeners added in the World inspector in the editor.

Parameters

Name Type Description
groupingListener IWorldGroupingListener

The World Grouping listener to remove.

groupingIndex int

The index of the World Grouping to remove the World Grouping listener from. If you have added the listener to multiple World Groupings on this World, call this method multiple times, once for each World Grouping.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

ResetAllGroupNamesOnAllWorldGroupings(int, [Action<World>])

public void ResetAllGroupNamesOnAllWorldGroupings(int zoneIndex, Action<World> onCompletedCallback = null)

Resets the Group Names of every LOD Group on every Zone Grouping of the input Zone back to the default names set in the inspector (changes persistent with save data if World is persistent).

This can be used if you have changed the group names in the past to an alternate name but want the World Groupings' LOD Groups to go back to using their default ones.

A rudimentary check is performed to try to catch instances when this method is called unecessarily. The check is performed separately for each World Grouping and adheres to the following rules:

1) If all LOD Groups on a Zone Grouping are already using their default Group Names, no Group Name reset occurs for that Grouping (however the callback, if provided, is still invoked).
2) If only one LOD Group is not using its default Group Name, only that LOD Group name is reset.
3) If more than one LOD Group is not using its default Group Name, all LOD Groups on the Zone Grouping are reset, regardless of whether each LOD Group is already using the default Group Name (as such, this may result in an unecessary refresh of the World Cells' Asset Chunks using the non changed LODs).

If you know only a few World Groupings need to be reset, it is better to use the method that targets a specific World Grouping. If you know only a few LOD Groups need to be reset, use the methods that target specific LOD Groups on specific Zone Groupings.

The world is automatically refreshed as a result of the Group Name changes, so this method should only be used when the world is hidden from the player (otherwise the player may see the change), and probably when the game is paused (so the player does not fall through the world).

Please note, all Group Name changes operate by performing LOD transitions from each World Cell currently belonging to the LOD of the World Grouping to a new World Cell of the same LOD but using the new chunks. This is important, as your custom World Grouping Listeners will only be notified of these updates if their IgnoreLODTransitions property is set to return false.

The operation is performed as a secondary operation using the World's update cycle, and as such if the World is currently in the process of being updated, or another secondary operation is in progress, those updates will be completed before this one begins execution. Once the new group names have been reset and objects refreshed to use the new names, the onCompletedCallback action will be called.

Parameters

Name Type Description
zoneIndex int

The index of the zone whose Grouping LOD Group Names you wish to reset.

onCompletedCallback Action<World>

An optional action that will be called after the Group Name reset operation has been completed.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World has been initialized.
InvalidOperationException Thrown when the method is called while the World is in the process of being destroyed.

ResetAllGroupNamesOnZoneGrouping(int, int, [Action<World>])

public void ResetAllGroupNamesOnZoneGrouping(int zoneIndex, int groupingIndex, Action<World> onCompletedCallback = null)

Resets the Group Names of all LOD Groups on the specified Zone Grouping of this World back to the default names set in the inspector (changes persistent with save data if World is persistent).

This can be used if you have changed the Group Names in the past to an alternate name but want the LOD Groups to go back to using their default ones.

A rudimentary check is performed to try to catch instances when this method is called unecessarily. It adheres to the following rules:

1) If all LOD Groups on the World Grouping are already using their default Group Names, no Group Name reset occurs (however the callback, if provided, is still invoked).
2) If only one LOD Group is not using its default Group Name, only that LOD Group is reset.
3) If more than one LOD Group is not using its default Group Name, all LOD Groups on the World Grouping are reset, regardless of whether each LOD Group is already using its default Group Name (as such, this may result in an unecessary refresh of the World Cell Asset Chunks using those unchanged LODs). If you know only a few LOD Groups need to be reset, use the method that targets specific LOD Groups on the World Grouping instead.

The world is automatically refreshed as a result of the Group Name changes, so this method should only be used when the world is hidden from the player (otherwise the player may see the change), and probably when the game is paused (so the player does not fall through the world).

Please note, all Group Name changes operate by performing LOD transitions from each World Cell currently belonging to the LOD of the World Grouping to a new World Cell of the same LOD but using the new chunks. This is important, as your custom World Grouping Listeners will only be notified of these updates if their IgnoreLODTransitions property is set to return false.

The operation is performed as a secondary operation using the World's update cycle, and as such if the World is currently in the process of being updated, or another secondary operation is in progress, those updates will be completed before this one begins execution. Once the group names have been reset and objects refreshed to use the new name, the onCompletedCallback action will be called.

Parameters

Name Type Description
zoneIndex int

The index of the Zone whose LOD Group Names you wish to reset.

groupingIndex int

The index of the World Grouping whose LOD Group Names you wish to reset.

onCompletedCallback Action<World>

An optional action that will be called after the Group Name reset operation has been completed.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World has been initialized.
InvalidOperationException Thrown when the method is called while the World is in the process of being destroyed.

ResetGroupName(int, int, [Action<World>])

public void ResetGroupName(int zoneIndex, int groupingIndex, int lodIndex, Action<World> onCompletedCallback = null)

Resets the Group Name of the specified LOD Group on the specified Zone Grouping of this World back to the default name set in the inspector (change persistent with save data if World is persistent).

This can be used if you have changed the Group Name in the past to an alternate name but want the LOD to go back to using its default one.

A check is performed to ensure the Group Name of the specified World Grouping's LOD Group is not already set to the default one, and nothing will happen if it is, although the callback (if provided) will still be invoked.

The world is automatically refreshed as a result of the Group Name change, so this method should only be used when the world is hidden from the player (otherwise the player may see the change), and probably when the game is paused (so the player does not fall through the world).

Please note, all Group Name changes operate by performing LOD transitions from each World Cell currently belonging to the LOD of the World Grouping to a new World Cell of the same LOD but using the new chunks. This is important, as your custom World Grouping Listeners will only be notified of these updates if their IgnoreLODTransitions property is set to return false.

The operation is performed as a secondary operation using the World's update cycle, and as such if the World is currently in the process of being updated, or another secondary operation is in progress, those updates will be completed before this one begins execution. Once the Group Name has been reset and objects refreshed to use the new name, the onCompletedCallback action will be called.

Parameters

Name Type Description
zoneIndex int

The index of the Zone whose LOD Group name you wish to reset.

groupingIndex int

The index of the World Grouping whose LOD Group Name you wish to reset.

lodIndex int

The index of the LOD Group on the World Grouping whose Group Name you wish to reset.

onCompletedCallback Action<World>

An optional action that will be called after the Group Name reset operation has been completed.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World has been initialized.
InvalidOperationException Thrown when the method is called while the World is in the process of being destroyed.

ReturnWorldCellForPooling(WorldCell)

public void ReturnWorldCellForPooling(WorldCell worldCell)

Returns a WorldCell created using CreateWorldCell or CreateWorldCellCopy so that it can be reused by SAM in order to save on memory.

Parameters

Name Type Description
worldCell WorldCell

The World Cell to return. Please do not return a World Cell unless it was created using the methods listed above, as if you return a World Cell created internally by SAM, it will cause major issues!

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initalized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double>, Cell, int, Action<World>)

public void TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, Cell cellInputPositionsAreRelativeTo, int groupingIndex, Action<World> onCompletedCallback)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the scheduling of the batch conversion jobs will be delayed until the current World update (if any) completes. Once the jobs are scheduled, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Use this method only if the execution of the method you are calling it from is not driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World.

In these instances, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. It may be necessary to use Persistent Allocation type with the Native Array, since there is no gaurantee that the job will run and finish before 4 frames have passed.

originCellInputPositionsAreRelativeTo Cell

The Endless Grid Cell the input positions are relative to.

groupingIndex int

The index of the World Grouping the cellInputPositionsAreRelativeTo is on.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the sceneRelativePositions will not be filled with valid data until this action is called.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double>, Cell, int, Action<World>)

public void TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, Cell cellInputPositionsAreRelativeTo, int groupingIndex, Action<World> onCompletedCallback)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the scheduling of the batch conversion jobs will be delayed until the current World update (if any) completes. Once the jobs are scheduled, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Use this method only if the execution of the method you are calling it from is not driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World.

In these instances, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. It may be necessary to use Persistent Allocation type with the Native Array, since there is no gaurantee that the job will run and finish before 4 frames have passed.

cellInputPositionsAreRelativeTo Cell

The Endless Grid Cell the input positions are relative to.

groupingIndex int

The index of the World Grouping the cellInputPositionsAreRelativeTo is on.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the sceneRelativePositions will not be filled with valid data until this action is called.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double>, List<Cell>, int, int, Action<World>)

public void TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double> positions, List<Cell> cellsInputPositionsAreRelativeTo, int groupingIndex, int minConversionsProcessedPerFrame, Action<World> onCompletedCallback)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out over multiple frames as a World secondary operation.

This means the execution of the batch conversion will be delayed until the current World update (if any) completes. Once the batch conversion starts, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

Use this method only if the execution of the method you are calling it from is not driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World. In these instances, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. You can reuse the list over and over again, however you should make sure to clear it first.

cellsInputPositionsAreRelativeTo List<Cell>

The Endless Grid Cells the input positions are relative to. Each index from positions is matched to an index from this list, so you need to make sure they match up.

groupingIndex int

The index of the World Grouping the cellsInputPositionsAreRelativeTo are on.

minConversionsProcessedPerFrame int

The mininum number of positions that will be converted each frame. Once this limit is reached, the World will query the Execution Controller to determine if it should yield or continue converting more positions.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the positions will not be correctly translated (and thus useable) until the action is triggered.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double>, NativeArray<Cell>, int, Action<World>)

public void TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, NativeArray<Cell> cellsInputPositionsAreRelativeTo, int groupingIndex, Action<World> onCompletedCallback)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the scheduling of the batch conversion jobs will be delayed until the current World update (if any) completes. Once the jobs are scheduled, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Use this method only if the execution of the method you are calling it from IS NOT driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World. In that case, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. It may be necessary to use Persistent Allocation type with the Native Array, since there is no gaurantee that the job will run and finish before 4 frames have passed.

cellsInputPositionsAreRelativeTo NativeArray<Cell>

The Endless Grid Cells the input positions are relative to. Each index from positions is matched to an index from this array, so you need to make sure they match up. It may be necessary to use Persistent Allocation type with the Native Array, since there is no gaurantee that the job will run and finish before 4 frames have passed. You also need to dispose of this array yourself!

groupingIndex int

The index of the World Grouping the cellsInputPositionsAreRelativeTo are on.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the positions will not be correctly translated (and thus useable) until the action is triggered.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double>, List<Cell>, int)

public void TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double> positions, List<Cell> cellsInputPositionsAreRelativeTo, int groupingIndex)

Uses a single frame approach to translate multiple positions relative to multiple Endless Grid Cells (cellsInputPositionsAreRelativeTo) to positions relative to the scene (World Space). This is useful when each input position is relative to a different Endless Grid Cell. The input cells are associated with a World Grouping, which is specified via groupingIndex.

This methods uses a single list for the positions to save on space. After the method runs, each position in the positions list will be replaced by the translated scene relative position. If for some reason you need to make use of the cell relative positions after the method is run, you will need to make a copy of the list before calling this method.

This method is meant to be used in situations where a floating origin based World is being used (one where its Origin Cell changes). In these situations, raw non static positions cannot be used as normal, because the state of the World at the time the position is being retrieved/used may be different than the state of the World when the position was recorded (i.e., the Origin Cell may be different).

The solution to this problem is to save the position value relative to a cell, and then save/send that cell value along with the new relative position. These positions can be used along with the cell they are relative to in order to produce a scene relative position, which you can then use to position the objects correctly.

When each position is saved for reuse or sent somewhere else, the cell it is relative to needs to also be recorded or sent so that the position can be translated back into a scene relative position via this method.

This method is carried out in a single frame, and when you have a large number of positions to translate this may cause a performance hitch. In that situation, you should use one of the other batch conversion methods.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the cell relative positions to translate. After the method completes, will contain the scene relative positions. You can reuse the list over and over again, however you should make sure to clear it first.

cellsInputPositionsAreRelativeTo List<Cell>

The Endless Grid Cells the input positions are relative to. Each index from positions is matched to an index from this list, so you need to make sure they match up.

groupingIndex int

The index of the World Grouping the cellsInputPositionsAreRelativeTo are on.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double>, List<Cell>, int, int)

public IEnumerator<YieldInstruction> TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double> positions, List<Cell> cellsInputPositionsAreRelativeTo, int groupingIndex, int maxConversionsProcessedPerFrame)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out over multiple frames using an iterator whose execution you must drive.

This means the execution of the batch conversion starts, continues, and finishes only if you drive it, usually using StartCoroutine or from another iterator based method that has been started using that method (although technically this method only yield returns null, so you can also drive it from a regular Update method as well).

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. You can reuse the list over and over again, however you should make sure to clear it first.

cellsInputPositionsAreRelativeTo List<Cell>

The Endless Grid Cells the input positions are relative to. Each index from positions is matched to an index from this list, so you need to make sure they match up.

groupingIndex int

The index of the World Grouping the cellsInputPositionsAreRelativeTo are on.

maxConversionsProcessedPerFrame int

The maximum number of positions that will be converted each frame. Once this limit is reached, the enumerator will yield for a frame.

Returns

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

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double>, NativeArray<Cell>, int, [bool])

public JobHandle TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, NativeArray<Cell> cellsInputPositionsAreRelativeTo, int groupingIndex, bool initializeWorkImmediately = true)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the execution of the batch conversion will be delayed until the current World update (if any) completes. Once the batch conversion starts, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. It may be necessary to use Persistent Allocation type with the Native Array, since there is no gaurantee that the job will run and finish before 4 frames have passed.

cellsInputPositionsAreRelativeTo NativeArray<Cell>

The Endless Grid Cells the input positions are relative to. Each index from positions is matched to an index from this array, so you need to make sure they match up. It may be necessary to use Persistent Allocation type with the Native Array, since there is no gaurantee that the job will run and finish before 4 frames have passed. You also need to dispose of this array yourself!

groupingIndex int

The index of the World Grouping the cellsInputPositionsAreRelativeTo are on.

initializeWorkImmediately bool

If true, the jobs which perform the translation will be scheduled and started before the JobHandle is returned, using the JobHandle.ScheduleBatchedJobs method.

If false, the job will be scheduled but the threads will not actually start working on the jobs. This is useful if you have additional jobs that you would like to schedule that depend on the returned JobHandle, as it is more performant to schedule those jobs and then call ScheduleBatchedJobs yourself.

Note that if you do not call ScheduleBatchedJobs after passing in false for this parameter, the returned JobHandle will never be completed!

Returns


The scheduled Job Handle. Use IsCompleted to check if the jobs are finished, then when it is true call JobHandle.Complete to finalize the data (not strictly sure if this is necessary but it shouldn't hurt anything to do it).

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double>, Cell, int, int, Action<World>)

public void TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double> positions, Cell cellInputPositionsAreRelativeTo, int groupingIndex, int minConversionsProcessedPerFrame, Action<World> onCompletedCallback)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out over multiple frames as a World secondary operation.

This means the execution of the batch conversion will be delayed until the current World update (if any) completes. Once the batch conversion starts, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

Use this method only if the execution of the method you are calling it from is not driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World. In these instances, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. You can reuse the list over and over again, however you should make sure to clear it first.

originCellInputPositionsAreRelativeTo Cell

The Endless Grid Cell the input positions are relative to.

groupingIndex int

The index of the World Grouping the cellInputPositionsAreRelativeTo is on.

minConversionsProcessedPerFrame int

The mininum number of positions that will be converted each frame. Once this limit is reached, the World will query the Execution Controller to determine if it should yield or continue converting more positions.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the sceneRelativePositions will not be filled with valid data until this action is called.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double>, Cell, int, int, Action<World>)

public void TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double> positions, Cell cellInputPositionsAreRelativeTo, int groupingIndex, int minConversionsProcessedPerFrame, Action<World> onCompletedCallback)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out over multiple frames as a World secondary operation.

This means the execution of the batch conversion will be delayed until the current World update (if any) completes. Once the batch conversion starts, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

Use this method only if the execution of the method you are calling it from is not driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World. In these instances, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. You can reuse the list over and over again, however you should make sure to clear it first.

cellInputPositionsAreRelativeTo Cell

The Endless Grid Cell the input positions are relative to.

groupingIndex int

The index of the World Grouping the cellInputPositionsAreRelativeTo is on.

minConversionsProcessedPerFrame int

The mininum number of positions that will be converted each frame. Once this limit is reached, the World will query the Execution Controller to determine if it should yield or continue converting more positions.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the sceneRelativePositions will not be filled with valid data until this action is called.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double>, Cell, int)

public void TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double> positions, Cell cellInputPositionsAreRelativeTo, int groupingIndex)

Uses a single frame approach to translate multiple positions relative to a single Endless Grid Cell (cellInputPositionIsRelativeTo) to positions relative to the scene (World Space). The input cell is associated with a World Grouping, which is specified via groupingIndex.

This methods uses a single list for the positions to save on space. After the method runs, each position in the positions list will be replaced by the translated scene relative position. If for some reason you need to make use of the cell relative positions after the method is run, you will need to make a copy of the list before calling this method.

This method is meant to be used in situations where a floating origin based World is being used (one where its Origin Cell changes). In these situations, raw non static positions cannot be used as normal, because the state of the World at the time the position is being retrieved/used may be different than the state of the World when the position was recorded (i.e., the Origin Cell may be different).

The solution to this problem is to save the position value relative to a cell, and then save/send that cell value along with the new relative position. These positions can be used along with the cell they are relative to in order to produce a scene relative position, which you can then use to position the objects correctly.

When the position is saved for reuse or sent somewhere else, the input cell needs to also be recorded or sent so that the position can be translated back into a scene relative position via this method.

This method is carried out in a single frame, and when you have a large number of positions to translate this may cause a performance hitch. In that situation, you should use one of the other batch conversion methods.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the cell relative positions to translate. After the method completes, will contain the scene relative positions. You can reuse the list over and over again, however you should make sure to clear it first.

originCellInputPositionsAreRelativeTo Cell

The Endless Grid Cell the input position is relative to.

groupingIndex int

The index of the World Grouping the cellPositionsAreRelativeTo is on.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double>, Cell, int)

public void TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double> positions, Cell cellInputPositionsAreRelativeTo, int groupingIndex)

Uses a single frame approach to translate multiple positions relative to a single Endless Grid Cell (cellInputPositionIsRelativeTo) to positions relative to the scene (World Space). The input cell is associated with a World Grouping, which is specified via groupingIndex.

This methods uses a single list for the positions to save on space. After the method runs, each position in the positions list will be replaced by the translated scene relative position. If for some reason you need to make use of the cell relative positions after the method is run, you will need to make a copy of the list before calling this method.

This method is meant to be used in situations where a floating origin based World is being used (one where its Origin Cell changes). In these situations, raw non static positions cannot be used as normal, because the state of the World at the time the position is being retrieved/used may be different than the state of the World when the position was recorded (i.e., the Origin Cell may be different).

The solution to this problem is to save the position value relative to a cell, and then save/send that cell value along with the new relative position. These positions can be used along with the cell they are relative to in order to produce a scene relative position, which you can then use to position the objects correctly.

When the position is saved for reuse or sent somewhere else, the input cell needs to also be recorded or sent so that the position can be translated back into a scene relative position via this method.

This method is carried out in a single frame, and when you have a large number of positions to translate this may cause a performance hitch. In that situation, you should use one of the other batch conversion methods.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the cell relative positions to translate. After the method completes, will contain the scene relative positions. You can reuse the list over and over again, however you should make sure to clear it first.

cellInputPositionsAreRelativeTo Cell

The Endless Grid Cell the input position is relative to.

groupingIndex int

The index of the World Grouping the cellPositionsAreRelativeTo is on.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double>, Cell, int, int)

public IEnumerator<YieldInstruction> TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double> positions, Cell cellInputPositionsAreRelativeTo, int groupingIndex, int maxConversionsProcessedPerFrame)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out over multiple frames using an iterator whose execution you must drive.

This means the execution of the batch conversion starts, continues, and finishes only if you drive it, usually using StartCoroutine or from another iterator based method that has been started using that method (although technically this method only yield returns null, so you can also drive it from a regular Update method as well).

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. You can reuse the list over and over again, however you should make sure to clear it first.

originCellInputPositionsAreRelativeTo Cell

The Endless Grid Cell the input positions are relative to.

groupingIndex int

The index of the World Grouping the cellInputPositionsAreRelativeTo is on.

maxConversionsProcessedPerFrame int

The maximum number of positions that will be converted each frame. Once this limit is reached, the enumerator will yield for a frame.

Returns

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

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double>, Cell, int, int)

public IEnumerator<YieldInstruction> TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(List<Vector3Double> positions, Cell cellInputPositionsAreRelativeTo, int groupingIndex, int maxConversionsProcessedPerFrame)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out over multiple frames using an iterator whose execution you must drive.

This means the execution of the batch conversion starts, continues, and finishes only if you drive it, usually using StartCoroutine or from another iterator based method that has been started using that method (although technically this method only yield returns null, so you can also drive it from a regular Update method as well).

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. You can reuse the list over and over again, however you should make sure to clear it first.

cellInputPositionsAreRelativeTo Cell

The Endless Grid Cell the input positions are relative to.

groupingIndex int

The index of the World Grouping the cellInputPositionsAreRelativeTo is on.

maxConversionsProcessedPerFrame int

The maximum number of positions that will be converted each frame. Once this limit is reached, the enumerator will yield for a frame.

Returns

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

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double>, Cell, int, [bool])

public JobHandle TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, Cell cellInputPositionsAreRelativeTo, int groupingIndex, bool initializeWorkImmediately = true)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the execution of the batch conversion will be delayed until the current World update (if any) completes. Once the batch conversion starts, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. It may be necessary to use Persistent Allocation type with the Native Array, since there is no gaurantee that the job will run and finish before 4 frames have passed.

originCellInputPositionsAreRelativeTo Cell

The Endless Grid Cell the input positions are relative to.

groupingIndex int

The index of the World Grouping the cellInputPositionsAreRelativeTo is on.

initializeWorkImmediately bool

If true, the jobs which perform the translation will be scheduled and started before the JobHandle is returned, using the JobHandle.ScheduleBatchedJobs method.

If false, the job will be scheduled but the threads will not actually start working on the jobs. This is useful if you have additional jobs that you would like to schedule that depend on the returned JobHandle, as it is more performant to schedule those jobs and then call ScheduleBatchedJobs yourself.

Note that if you do not call ScheduleBatchedJobs after passing in false for this parameter, the returned JobHandle will never be completed!

Returns


The scheduled Job Handle. Use IsCompleted to check if the jobs are finished, then when it is true call JobHandle.Complete to finalize the data (not strictly sure if this is necessary but it shouldn't hurt anything to do it).

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double>, Cell, int, [bool])

public JobHandle TranslateCellRelativePositionToSceneRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, Cell cellInputPositionsAreRelativeTo, int groupingIndex, bool initializeWorkImmediately = true)

Similar to TranslateCellRelativePositionToSceneRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the execution of the batch conversion will be delayed until the current World update (if any) completes. Once the batch conversion starts, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, use TranslateCellRelativePositionToSceneRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the cell relative positions to translate. After the onCompletedCallback action triggers, will contain the scene relative positions. It may be necessary to use Persistent Allocation type with the Native Array, since there is no gaurantee that the job will run and finish before 4 frames have passed.

cellInputPositionsAreRelativeTo Cell

The Endless Grid Cell the input positions are relative to.

groupingIndex int

The index of the World Grouping the cellInputPositionsAreRelativeTo is on.

initializeWorkImmediately bool

If true, the jobs which perform the translation will be scheduled and started before the JobHandle is returned, using the JobHandle.ScheduleBatchedJobs method.

If false, the job will be scheduled but the threads will not actually start working on the jobs. This is useful if you have additional jobs that you would like to schedule that depend on the returned JobHandle, as it is more performant to schedule those jobs and then call ScheduleBatchedJobs yourself.

Note that if you do not call ScheduleBatchedJobs after passing in false for this parameter, the returned JobHandle will never be completed!

Returns


The scheduled Job Handle. Use IsCompleted to check if the jobs are finished, then when it is true call JobHandle.Complete to finalize the data (not strictly sure if this is necessary but it shouldn't hurt anything to do it).

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition(Vector3Double, Cell, int)

public Vector3Double TranslateCellRelativePositionToSceneRelativePosition(Vector3Double cellRelativePosition, Cell cellInputPositionIsRelativeTo, int groupingIndex)

Translates a position relative to the input Endless Grid Cell (cellInputPositionIsRelativeTo) to a position relative to the scene (World Space). The input cell is associated with a World Grouping, which is specified via groupingIndex.

This method is meant to be used in situations where a floating origin based World is being used (one where its Origin Cell changes). In these situations, raw non static positions cannot be used as normal, because the state of the World at the time the position is being retrieved/used may be different than the state of the World when the position was recorded (i.e., the Origin Cell may be different).

The solution to this problem is to save the position value relative to a cell, and then save/send that cell value along with the new relative position. These positions can be used along with the cell they are relative to in order to produce a scene relative position, which you can then use to position the objects correctly.

When the position is saved for reuse or sent somewhere else, the input cell needs to also be recorded or sent so that the position can be translated back into a scene relative position via this method.

If you wish to translate multiple positions, you may wish to use one of the BatchConversion methods instead.

Parameters

Name Type Description
cellRelativePosition Vector3Double

The cell relative position to translate.

originCellInputPositionIsRelativeTo Cell

The Endless Grid Cell the input position is relative to.

groupingIndex int

The index of the World Grouping the cellInputPositionIsRelativeTo is on.

Returns

Vector3Double
The position relative to the scene (World Space).

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateCellRelativePositionToSceneRelativePosition(Vector3Double, Cell, int)

public Vector3Double TranslateCellRelativePositionToSceneRelativePosition(Vector3Double cellRelativePosition, Cell cellInputPositionIsRelativeTo, int groupingIndex)

Translates a position relative to the input Endless Grid Cell (cellInputPositionIsRelativeTo) to a position relative to the scene (World Space). The input cell is associated with a World Grouping, which is specified via groupingIndex.

This method is meant to be used in situations where a floating origin based World is being used (one where its Origin Cell changes). In these situations, raw non static positions cannot be used as normal, because the state of the World at the time the position is being retrieved/used may be different than the state of the World when the position was recorded (i.e., the Origin Cell may be different).

The solution to this problem is to save the position value relative to a cell, and then save/send that cell value along with the new relative position. These positions can be used along with the cell they are relative to in order to produce a scene relative position, which you can then use to position the objects correctly.

When the position is saved for reuse or sent somewhere else, the input cell needs to also be recorded or sent so that the position can be translated back into a scene relative position via this method.

If you wish to translate multiple positions, you may wish to use one of the BatchConversion methods instead.

Parameters

Name Type Description
cellRelativePosition Vector3Double

The cell relative position to translate.

cellInputPositionIsRelativeTo Cell

The Endless Grid Cell the input position is relative to.

groupingIndex int

The index of the World Grouping the cellInputPositionIsRelativeTo is on.

Returns

Vector3Double
The position relative to the scene (World Space).

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double>, Cell, int, int, Action<World>)

public void TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double> positions, Cell cellOutputPositionsAreRelativeTo, int groupingIndex, int minConversionsProcessedPerFrame, Action<World> onCompletedCallback)

Similar to TranslateSceneRelativePositionToCellRelativePosition_BatchConversion except the conversions are carried out over multiple frames as a World secondary operation.

This means the execution of the batch conversion will be delayed until the current World update (if any) completes. Once the batch conversion starts, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

Use this method only if the execution of the method you are calling it from is not driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World. In these instances, use TranslateSceneRelativePositionToCellRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the scene relative positions to translate. Once the onCompletedCallback action triggers, will contain the translated cell relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

cellOutputPositionsAreRelativeTo Cell

The reference Endless Grid Cell to use to find the relative position. All positions in cellRelativePositions will be relative to this cell, i.e., a value of x = 100, y = 200 means the position is 100/200 units away from the x/y position of the cell.

groupingIndex int

The World Grouping which the cellOutputPositionsAreRelativeTo belongs to.

minConversionsProcessedPerFrame int

The mininum number of positions that will be converted each frame. Once this limit is reached, the World will query the Execution Controller to determine if it should yield or continue converting more positions.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the cellRelativePositions will not be filled with valid data until this action is called.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(NativeArray<Vector3Double>, Cell, int, Action<World>)

public void TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, Cell cellOutputPositionsAreRelativeTo, int groupingIndex, Action<World> onCompletedCallback)

Similar to TranslateSceneRelativePositionToCellRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the scheduling of the batch conversion jobs will be delayed until the current World update (if any) completes. Once the jobs are scheduled, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Use this method only if the execution of the method you are calling it from is not driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World. In these instances, use TranslateSceneRelativePositionToCellRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the scene relative positions to translate. After the onCompletedCallback action triggers, will contain the translated cell relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

cellOutputPositionsAreRelativeTo Cell

The reference Endless Grid Cell to use to find the relative position. All positions in cellRelativePositions will be relative to this cell, i.e., a value of x = 100, y = 200 means the position is 100/200 units away from the x/y position of the cell.

groupingIndex int

The World Grouping which the cellOutputPositionsAreRelativeTo belongs to.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the cellRelativePositions will not be filled with valid data until this action is called.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double>, Cell, int)

public void TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double> positions, Cell cellOutputPositionsAreRelativeTo, int groupingIndex)

Uses a single frame conversion process to translate an list of positions relative to the scene (World Space) to positions relative to a specific Endless Grid Cell on the World Grouping specified.

This methods uses a single list for the positions to save on space. After the method runs, each position in the positions list will be replaced by the translated cell relative position. If for some reason you need to make use of the scene relative positions after the method is run, you will need to make a copy of the list before calling this method.

This method is meant to be used in situations where a floating origin based World is being used (one where its Origin Cell changes). In these situations, raw non static positions cannot be used as normal, because the state of the World at the time the position is being retrieved/used may be different than the state of the World when the position was recorded (i.e., the Origin Cell may be different).

The solution to this problem is to save the position value relative to a cell, and then save/send that cell value along with the new relative position. Truthfully, you can use any Endless Grid Cell for this purpose, including the Origin Cell, however in some instances using a specific cell (other than the Origin Cell) is easier.

In either case, when the position is saved for reuse or sent somewhere else, the reference cell needs to also be recorded or sent so that the positions can be translated back into scene relative positions via one of the cell relative to scene relative positions batch conversion methods.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the scene relative positions to translate. After the method runs, will contain the translated cell relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

cellOutputPositionsAreRelativeTo Cell

The reference Endless Grid Cell to use to find the relative position. All positions in cellRelativePositions will be relative to this cell, i.e., a value of x = 100, y = 200 means the position is 100/200 units away from the x/y position of the cell.

groupingIndex int

The World Grouping which the cellOutputPositionsAreRelativeTo belongs to.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double>, Cell, int, int)

public IEnumerator<YieldInstruction> TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double> positions, Cell cellOutputPositionsAreRelativeTo, int groupingIndex, int maxConversionsProcessedPerFrame)

Similar to TranslateSceneRelativePositionToCellRelativePosition_BatchConversion except the conversions are carried out over multiple frames using an iterator whose execution you must drive.

This means the execution of the batch conversion starts, continues, and finishes only if you drive it, usually using StartCoroutine or from another iterator based method that has been started using that method (although technically this method only yield returns null, so you can also drive it from a regular Update method as well).

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, use TranslateSceneRelativePositionToCellRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the scene relative positions to translate. Once the onCompletedCallback action triggers, will contain the translated cell relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

cellOutputPositionsAreRelativeTo Cell

The reference Endless Grid Cell to use to find the relative position. All positions in cellRelativePositions will be relative to this cell, i.e., a value of x = 100, y = 200 means the position is 100/200 units away from the x/y position of the cell.

groupingIndex int

The World Grouping which the cellOutputPositionsAreRelativeTo belongs to.

maxConversionsProcessedPerFrame int

The maximum number of positions that will be converted each frame. Once this limit is reached, the enumerator will yield for a frame.

Returns

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

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(NativeArray<Vector3Double>, Cell, int, [bool])

public JobHandle TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, Cell cellOutputPositionsAreRelativeTo, int groupingIndex, bool initializeWorkImmediately = true)

Similar to TranslateSceneRelativePositionToCellRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the scheduling of the batch conversion jobs will be delayed until the current World update (if any) completes. Once the jobs are scheduled, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, use TranslateSceneRelativePositionToCellRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the scene relative positions to translate. After the onCompletedCallback action triggers, will contain the translated cell relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

cellOutputPositionsAreRelativeTo Cell

The reference Endless Grid Cell to use to find the relative position. All positions in cellRelativePositions will be relative to this cell, i.e., a value of x = 100, y = 200 means the position is 100/200 units away from the x/y position of the cell.

groupingIndex int

The World Grouping which the cellOutputPositionsAreRelativeTo belongs to.

initializeWorkImmediately bool

If true, the jobs which perform the translation will be scheduled and started before the JobHandle is returned, using the JobHandle.ScheduleBatchedJobs method.

If false, the job will be scheduled but the threads will not actually start working on the jobs. This is useful if you have additional jobs that you would like to schedule that depend on the returned JobHandle, as it is more performant to schedule those jobs and then call ScheduleBatchedJobs yourself.

Note that if you do not call ScheduleBatchedJobs after passing in false for this parameter, the returned JobHandle will never be completed!

Returns


The scheduled Job Handle. Use IsCompleted to check if the jobs are finished, then when it is true call JobHandle.Complete to finalize the data (not strictly sure if this is necessary but it shouldn't hurt anything to do it).

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double>, List<Cell>, int, int, Action<World>)

public void TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double> positions, List<Cell> cellsOutputPositionsAreRelativeTo, int groupingIndex, int minConversionsProcessedPerFrame, Action<World> onCompletedCallback)

Similar to TranslateSceneRelativePositionToCellRelativePosition_BatchConversion except the conversions are carried out over multiple frames as a World secondary operation.

This means the execution of the batch conversion will be delayed until the current World update (if any) completes. Once the batch conversion starts, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

Use this method only if the execution of the method you are calling it from is not driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World. In these instances, use TranslateSceneRelativePositionToCellRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the scene relative positions to translate. Once the onCompletedCallback action triggers, will contain the translated cell relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

cellsOutputPositionsAreRelativeTo List<Cell>

Once the onCompletedCallback action is triggered, will contain the Endless Grid Cells that each input position is in. If you cleared this list before calling the method, the indexes will correspond perfectly with the positions list (otherwise the list is not cleared by this method, so if it contains elements they will remain there!).

groupingIndex int

The World Grouping which the cellOutputPositionsAreRelativeTo belongs to.

minConversionsProcessedPerFrame int

The mininum number of positions that will be translated each frame. Once this limit is reached, the World will query the Execution Controller to determine if it should yield or continue translating more positions.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the data will not be valid until it is triggered.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(NativeArray<Vector3Double>, NativeArray<Cell>, int, Action<World>)

public void TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, NativeArray<Cell> cellsOutputPositionsAreRelativeTo, int groupingIndex, Action<World> onCompletedCallback)

Similar to TranslateSceneRelativePositionToCellRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the scheduling of the batch conversion jobs will be delayed until the current World update (if any) completes. Once the jobs are scheduled, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Use this method only if the execution of the method you are calling it from is not driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World. In these instances, use TranslateSceneRelativePositionToCellRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the scene relative positions to translate. After the onCompletedCallback action triggers, will contain the translated cell relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

cellsOutputPositionsAreRelativeTo NativeArray<Cell>

Once the onCompletedCallback action is triggered, will contain the Endless Grid Cells that each input position is in. If you cleared this list before calling the method, the indexes will correspond perfectly with the positions list (otherwise the list is not cleared by this method, so if it contains elements they will remain there!).

groupingIndex int

The World Grouping which the cellOutputPositionsAreRelativeTo belongs to.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the cellRelativePositions will not be filled with valid data until this action is called.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double>, List<Cell>, int)

public void TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double> positions, List<Cell> cellsOutputPositionsAreRelativeTo, int groupingIndex)

Uses a single frame based approach to identify the Endless Grid Cell each scene relative position is in, and then translate each scene relative position to a position relative to that cell.

This methods uses a single list for the positions to save on space. After the method runs, each position in the positions list will be replaced by the translated cell relative position. If for some reason you need to make use of the scene relative positions after the method is run, you will need to make a copy of the list before calling this method.

This method is meant to be used in situations where a floating origin based World is being used (one where its Origin Cell changes). In these situations, raw non static positions cannot be used as normal, because the state of the World at the time the position is being retrieved/used may be different than the state of the World when the position was recorded (i.e., the Origin Cell may be different).

The solution to this problem is to save the position value relative to a cell, and then save/send that cell value along with the new relative position. Truthfully, you can use any Endless Grid Cell for this purpose, including the Origin Cell, however in some instances using a specific cell (other than the Origin Cell) is easier.

In either case, when the positions are saved for reuse or sent somewhere else, the cells the position are relative to also need to be recorded or sent so that the positions can be translated back into scene relative positions via one of the cell relative to scene relative positions batch conversion methods.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the scene relative positions to translate. After the method runs, will contain the translated cell relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

cellsOutputPositionsAreRelativeTo List<Cell>

Once the method completes, will contain the Endless Grid Cells that each input position is in. If you cleared this list before calling the method, the indexes will correspond perfectly with the positions list (otherwise the list is not cleared by this method, so if it contains elements before being called they will still be there!).

groupingIndex int

The World Grouping which the cellsOutputPositionsAreRelativeTo belongs to.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double>, List<Cell>, int, int)

public IEnumerator<YieldInstruction> TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(List<Vector3Double> positions, List<Cell> cellsOutputPositionsAreRelativeTo, int groupingIndex, int maxConversionsProcessedPerFrame)

Similar to TranslateSceneRelativePositionToCellRelativePosition_BatchConversion except the conversions are carried out over multiple frames using an iterator whose execution you must drive.

This means the execution of the batch conversion starts, continues, and finishes only if you drive it, usually using StartCoroutine or from another iterator based method that has been started using that method (although technically this method only yield returns null, so you can also drive it from a regular Update method as well).

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, use TranslateSceneRelativePositionToCellRelativePosition_BatchConversion

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the scene relative positions to translate. Once the onCompletedCallback action triggers, will contain the translated cell relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

cellsOutputPositionsAreRelativeTo List<Cell>

Once the onCompletedCallback action is triggered, will contain the Endless Grid Cells that each input position is in. If you cleared this list before calling the method, the indexes will correspond perfectly with the positions list (otherwise the list is not cleared by this method, so if it contains elements they will remain there!).

groupingIndex int

The World Grouping which the cellOutputPositionsAreRelativeTo belongs to.

maxConversionsProcessedPerFrame int

The maximum number of positions that will be converted each frame. Once this limit is reached, the enumerator will yield for a frame.

Returns

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

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(NativeArray<Vector3Double>, NativeArray<Cell>, int, [bool])

public JobHandle TranslateSceneRelativePositionToCellRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, NativeArray<Cell> cellsOutputPositionsAreRelativeTo, int groupingIndex, bool initializeWorkImmediately = true)

Similar to TranslateSceneRelativePositionToCellRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the scheduling of the batch conversion jobs will be delayed until the current World update (if any) completes. Once the jobs are scheduled, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, use TranslateSceneRelativePositionToCellRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the scene relative positions to translate. After the onCompletedCallback action triggers, will contain the translated cell relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

cellsOutputPositionsAreRelativeTo NativeArray<Cell>

Once the onCompletedCallback action is triggered, will contain the Endless Grid Cells that each input position is in. If you cleared this list before calling the method, the indexes will correspond perfectly with the positions list (otherwise the list is not cleared by this method, so if it contains elements they will remain there!).

groupingIndex int

The World Grouping which the cellOutputPositionsAreRelativeTo belongs to.

initializeWorkImmediately bool

If true, the jobs which perform the translation will be scheduled and started before the JobHandle is returned, using the JobHandle.ScheduleBatchedJobs method.

If false, the job will be scheduled but the threads will not actually start working on the jobs. This is useful if you have additional jobs that you would like to schedule that depend on the returned JobHandle, as it is more performant to schedule those jobs and then call ScheduleBatchedJobs yourself.

Note that if you do not call ScheduleBatchedJobs after passing in false for this parameter, the returned JobHandle will never be completed!

Returns


The scheduled Job Handle. Use IsCompleted to check if the jobs are finished, then when it is true call JobHandle.Complete to finalize the data (not strictly sure if this is necessary but it shouldn't hurt anything to do it).

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition(Vector3Double, int, out Cell)

public Vector3Double TranslateSceneRelativePositionToCellRelativePosition(Vector3Double sceneRelativePosition, int groupingIndex, out Cell cellOutputPositionIsRelativeTo)

This method first identifies the Endless Grid Cell on the Zone and World Grouping specified that the input scene relative position is in, then translates the scene relative position to a position relative to this cell (and returns it).

This method is meant to be used in situations where a floating origin based World is being used (one where its Origin Cell changes). In these situations, raw non static positions cannot be used as normal, because the state of the World at the time the position is being retrieved/used may be different than the state of the World when the position was recorded (i.e., the Origin Cell may be different).

The solution to this problem is to save the position value relative to a cell, and then save/send that cell value along with the new relative position.

When the position is saved for reuse or sent somewhere else, the cell the position is relative to also needs to be recorded or sent so that the position can be translated back into a scene relative position via one of the cell relative to scene relative position conversion methods.

If you need to convert multiple positions you may be better off using one of the BatchConversion methods of the same name.

Parameters

Name Type Description
sceneRelativePosition Vector3Double

The scene relative position to translate.

groupingIndex int

The World Grouping which the cellOutputPositionIsRelativeTo belongs to.

cellOutputPositionIsRelativeTo Cell

The Endless Grid Cell the output position will be relative to (will be set after method returns).

Returns

Vector3Double
The position relative to cellOutputPositionIsRelativeTo.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToCellRelativePosition(Vector3Double, Cell, int)

public Vector3Double TranslateSceneRelativePositionToCellRelativePosition(Vector3Double sceneRelativePosition, Cell cellOutputPositionIsRelativeTo, int groupingIndex)

Translates a single position relative to the scene (World Space) to a position relative to the input Endless Grid Cell (cellOutputPositionIsRelativeTo) on the World Grouping specified.

This method is meant to be used in situations where a floating origin based World is being used (one where its Origin Cell changes). In these situations, raw non static positions cannot be used as normal, because the state of the World at the time the position is being retrieved/used may be different than the state of the World when the position was recorded (i.e., the Origin Cell may be different).

The solution to this problem is to save the position value relative to a cell, and then save/send that cell value along with the new relative position.

When the position is saved for reuse or sent somewhere else, the input cell needs to also be recorded or sent so that the position can be translated back into a scene relative position via one of the cell relative to scene relative position conversion methods.

If you need to convert multiple positions you may be better off using one of the BatchConversion methods of the same name.

Parameters

Name Type Description
sceneRelativePosition Vector3Double

The scene relative position to translate.

cellOutputPositionIsRelativeTo Cell

The Endless Grid Cell the output position will be relative to.

groupingIndex int

The World Grouping which the cellOutputPositionIsRelativeTo belongs to.

Returns

Vector3Double
The position relative to cellOutputPositionIsRelativeTo.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion(List<Vector3Double>, Cell[], int, Action<World>)

public void TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion(List<Vector3Double> positions, Cell[] originCellPositionsAreRelativeTo, int minConversionsProcessedPerFrame, Action<World> onCompletedCallback)

Similar to TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion except the conversions are carried out over multiple frames as a World secondary operation.

This means the execution of the batch conversion will be delayed until the current World update (if any) completes. Once the batch conversion starts, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

Use this method only if the execution of the method you are calling it from is not driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World. In these instances, use TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the scene relative positions to translate. After the onCompletedCallback action triggers, will contain the translated origin relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

originCellPositionsAreRelativeTo Cell[]

An array initialized with at least a lenght of 1. After onCompletedCallback is invoked, index 0 of this array will contain the Origin Cell of the World at the time of the conversion. You should store this Origin Cell along with the positions so that they can be converted back to scene relative positions at a later time.

minConversionsProcessedPerFrame int

The mininum number of positions that will be converted each frame. Once this limit is reached, the World will query the Execution Controller to determine if it should yield or continue converting more positions.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the originCellRelativePositions and originCellPositionsAreRelativeTo will not be filled with valid data until this action is called.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion(NativeArray<Vector3Double>, NativeArray<Cell>, Action<World>)

public void TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, NativeArray<Cell> originCellPositionsAreRelativeTo, Action<World> onCompletedCallback)

Similar to TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the scheduling of the batch conversion jobs will be delayed until the current World update (if any) completes. Once the jobs are scheduled, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

Use this method only if the execution of the method you are calling it from is not driven by the World. If the execution is driven by the World (one of the methods of the World Grouping Listener, for example), using this method will stall out the World. In these instances, use TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the scene relative positions to translate. After the onCompletedCallback action triggers, will contain the translated origin relative positions. It may be necessary to use Persistent Allocation type with the Native Array, since there is no gaurantee that the job will run and finish before 4 frames have passed.

originCellPositionsAreRelativeTo NativeArray<Cell>

An NativeArray initialized with at least a lenght of 1. After onCompletedCallback is invoked, index 0 of this array will contain the Origin Cell that was used to perform the conversion. You should store this Origin Cell along with the positions so that they can be converted back to scene relative positions at a later time.

onCompletedCallback Action<World>

Action which will be triggered after the conversion is complete. You must provide this because the originCellRelativePositions and originCellPositionsAreRelativeTo will not be filled with valid data until this action is called.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion(List<Vector3Double>)

public Vector3Double TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion(List<Vector3Double> positions)

Uses a single frame approach to translate an array of positions relative to the scene (World Space) to positions relative to the Origin Cell of World Grouping 1 on this world.

This method is meant to be used in situations where a floating origin based World is being used (one where its Origin Cell changes). In these situations, raw non static positions cannot be used as normal, because the state of the World at the time the position is being retrieved/used may be different than the state of the World when the position was recorded (i.e., the Origin Cell may be different).

The solution to this problem is to save the position value relative to a cell, and then save/send that cell value along with the new relative position. Truthfully, you can use any Endless Grid Cell for this purpose, including the cell that the position actually falls within, however in some instances using the Origin Cell as the reference is easier.

Note, if your World Origin Position 0,0,0, then the Origin Cell relative position will be equivalent to the position within the scene, so calling this method is redundant. Just save the scene position along with the current Origin Cell.

In either case, when the position is saved for reuse or sent somewhere else, the Origin Cell needs to also be recorded or sent so that the position can be translated back into a scene relative position via one of the cell relative to scene relative position conversion methods. You can use the Origin Cell property for this purpose. Note that you must record the Origin Cell that is set at the time of saving/sending the position, since this Origin Cell may change in the future.

Note regarding performance critical code: If you wish to perform batch conversions of scene relative positions to Origin Cell relative positions, you are better off not using this method and instead using the batch conversion methods.

Final Note! Use of this method is only recommended if your game layout is stable, which is to say your Zone positions within the game world will not move in the future. If your zones are not stable and might be moved, you should use one of the methods that gives you a Zone Cell relative position. If you do not heed this advice, when you move your Zone, the position will not move in conjuction with the zone position change!

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the scene relative positions to translate. After the method completes, will contain the translated origin relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion(List<Vector3Double>, Cell[], int)

public IEnumerator<YieldInstruction> TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion(List<Vector3Double> positions, Cell[] originCellPositionsAreRelativeTo, int maxConversionsProcessedPerFrame)

Similar to TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion except the conversions are carried out over multiple frames using an iterator whose execution you must drive.

This means the execution of the batch conversion starts, continues, and finishes only if you drive it, usually using StartCoroutine or from another iterator based method that has been started using that method (although technically this method only yield returns null, so you can also drive it from a regular Update method as well).

Using the job based method is recommend over this one, however this is useful if you wish to avoid jobs for some reason.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, you should use TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion

Parameters

Name Type Description
positions List<Vector3Double>

When passed in, contains the scene relative positions to translate. After the onCompletedCallback action triggers, will contain the translated origin relative positions. This uses a list so that you can reuse the list over and over again, if you desire.

originCellPositionsAreRelativeTo Cell[]

An array initialized with at least a lenght of 1. After onCompletedCallback is invoked, index 0 of this array will contain the Origin Cell that was used to perform the conversion. You should store this Origin Cell along with the positions so that they can be converted back to scene relative positions at a later time.

maxConversionsProcessedPerFrame int

The maximum number of positions that will be converted each frame. Once this limit is reached, the enumerator will yield for a frame.

Returns

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

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion(NativeArray<Vector3Double>, NativeArray<Cell>, [bool])

public JobHandle TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion(NativeArray<Vector3Double> positions, NativeArray<Cell> originCellPositionsAreRelativeTo, bool initializeWorkImmediately = true)

Similar to TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion except the conversions are carried out using the Jobs system as a World secondary operation.

This means the scheduling of the batch conversion jobs will be delayed until the current World update (if any) completes. Once the jobs are scheduled, all World updates are delayed, which is useful as it ensures the state of the World will remain consistent during the conversion process.

You should use this method only if the execution of the method you are calling it from IS driven by the World (one of the methods of the World Grouping Listener, for example). If the execution IS NOT driven by the World, using this method can be dangerous as the World's state may change while the conversion is in progress, if for example an Origin Cell is executed during the conversion process. In that case, you should use TranslateSceneRelativePositionToOriginCellRelativePosition_BatchConversion instead.

Parameters

Name Type Description
positions NativeArray<Vector3Double>

When passed in, contains the scene relative positions to translate. After the onCompletedCallback action triggers, will contain the translated origin relative positions. It may be necessary to use Persistent Allocation type with the Native Array, since there is no gaurantee that the job will run and finish before 4 frames have passed.

originCellPositionsAreRelativeTo NativeArray<Cell>

An NativeArray initialized with at least a lenght of 1. After onCompletedCallback is invoked, index 0 of this array will contain the Origin Cell that was used to perform the conversion. You should store this Origin Cell along with the positions so that they can be converted back to scene relative positions at a later time.

initializeWorkImmediately bool

If true, the jobs which perform the translation will be scheduled and started before the JobHandle is returned, using the JobHandle.ScheduleBatchedJobs method.

If false, the job will be scheduled but the threads will not actually start working on the jobs. This is useful if you have additional jobs that you would like to schedule that depend on the returned JobHandle, as it is more performant to schedule those jobs and then call ScheduleBatchedJobs yourself.

Note that if you do not call ScheduleBatchedJobs after passing in false for this parameter, the returned JobHandle will never be completed!

Returns


The scheduled Job Handle. Use IsCompleted to check if the jobs are finished, then when it is true call JobHandle.Complete to finalize the data (not strictly sure if this is necessary but it shouldn't hurt anything to do it).

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TranslateSceneRelativePositionToOriginCellRelativePosition_SingleImmediate(Vector3Double)

public Vector3Double TranslateSceneRelativePositionToOriginCellRelativePosition_SingleImmediate(Vector3Double sceneRelativePosition)

Translates a position relative to the scene (World Space) to a position relative to the Origin Cell of this World.

This method is meant to be used in situations where a floating origin based World is being used (one where its Origin Cell changes). In these situations, raw non static positions cannot be used as normal, because the state of the World at the time the position is being retrieved/used may be different than the state of the World when the position was recorded (i.e., the Origin Cell may be different).

The solution to this problem is to save the position value relative to a cell, and then save/send that cell value along with the new relative position. Truthfully, you can use any Endless Grid Cell for this purpose, including the cell that the position actually falls within, however in some instances using the Origin Cell as the reference is easier.

Note, if your World Origin Position 0,0,0, then the Origin Cell relative position will be equivalent to the position within the scene, so calling this method is redundant. Just save the scene position along with the current Origin Cell.

In either case, when the position is saved for reuse or sent somewhere else, the Origin Cell needs to also be recorded or sent so that the position can be translated back into a scene relative position via one of the cell relative to scene relative position conversion methods. You can use the Origin Cell property for this purpose. Note that you must record the Origin Cell that is set at the time of saving/sending the position, since this Origin Cell may change in the future.

Note regarding performance critical code: If you wish to perform batch conversions of scene relative positions to Origin Cell relative positions, you are better off not using this method and instead using the batch conversion methods.

Final Note! Use of this method is only recommended if your game layout is stable, which is to say your Zone positions within the game world will not move in the future. If your zones are not stable and might be moved, you should use one of the methods that gives you a Zone Cell relative position. If you do not heed this advice, when you move your Zone, the position will not move in conjuction with the zone position change!

Parameters

Name Type Description
sceneRelativePosition Vector3Double

The scene relative position to translate.

Returns

Vector3Double
The translated World Origin Cell relative position.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when the method is called before the World is initialized.

TryGetWorldCellAssociatedWithEndlessGridCell(Cell, int, out WorldCell, out NullWorldCellError)

public bool TryGetWorldCellAssociatedWithEndlessGridCell(Cell endlessGridCell, int groupingIndex, out WorldCell worldCell, out NullWorldCellError reasonForFailure)

Tries to get the World Cell associated with the Endless Grid Cell. If no World Cell can be identified, false will be returned and worldCell will be null. In this case, reasonForFailure can tell you important information on why the World Cell could not be found, such as the Endless Grid Cell was outside the bounds of the Streamable Grid or was associated with an disabled Streamable Grid Cell.

Parameters

Name Type Description
endlessGridCell Cell

The Endless Grid Cell to use to find the World Cell.

zoneIndex int

The index of the Zone which contains the World Cell in question.

groupingIndex int

The index of the World Grouping which contains the World Cell in question.

worldCell WorldCell

When this method returns, contains the World Cell associated with the Endless Grid Cell, or null if a World Cell cannot be identified.

reasonForFailure NullWorldCellError

If a World Cell was not located, this will tell you why the retrieval failed.

Returns

bool
A bool indicating whether the World Cell was able to be retrieved.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

TryGetWorldCellAssociatedWithEndlessGridCell(Cell, int, out WorldCell)

public bool TryGetWorldCellAssociatedWithEndlessGridCell(Cell endlessGridCell, int groupingIndex, out WorldCell worldCell)

Tries to get the World Cell that the position is in. This method may fail to identify a World Cell for several reasons. If you are having trouble identifing the reason, you can use the alternative method with the out string parameter.

Parameters

Name Type Description
endlessGridCell Cell

The Endless Grid Cell to use to find the World Cell.

groupingIndex int

The index of the World Grouping which contains the World Cell in question.

worldCell WorldCell

When this method returns, contains the World Cell associated with the Endless Grid Cell, or null if a World Cell cannot be identified.

Returns

bool
A bool indicating whether the World Cell was able to be retrieved.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

TryGetWorldCellPositionIsIn(Vector3Double, int, out WorldCell, out NullWorldCellError)

public bool TryGetWorldCellPositionIsIn(Vector3Double position, int groupingIndex, out WorldCell worldCell, out NullWorldCellError reasonForFailure)

Tries to get the World Cell that the position is in. If no World Cell can be identified, false will be returned and worldCell will be null. In this case, reasonForFailure can tell you important information on why the World Cell could not be found, such as the position was outside the bounds of the Streamable Grid or fell within the bounds of a disabled Streamable Grid Cell.

Parameters

Name Type Description
position Vector3Double

The position in world space. Note that for 2D World Groupings, the position on the third unused axis is still taken into account with this method, and the position must fall within the dimensions of the single Layer of the Zone Grouping.

zoneIndex int

The index of the Zone which contains the World Cell in question.

groupingIndex int

The index of the World Grouping which contains the World Cell in question.

worldCell WorldCell

When this method returns, contains the World Cell associated with the Endless Grid Cell, or null if a World Cell cannot be identified

reasonForFailure NullWorldCellError

If a World Cell cannot be retrieved, this will tell you why.

Returns

bool
A bool indicating whether the World Cell was able to be retrieved.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

TryGetWorldCellPositionIsIn(Vector3Double, int groupingIndex, out WorldCell)

public bool TryGetWorldCellPositionIsIn(Vector3Double position, int, out WorldCell worldCell)

Tries to get the World Cell that the position is in. This method may fail to identify a World Cell for several reasons. If you are having trouble identifing the reason, you can use the alternative method with the out string reasonForFailure parameter.

Parameters

Name Type Description
position Vector3Double

The position in world space. Note that for 2D World Groupings, the position on the third unused axis is still taken into account with this method, and the position must fall within the dimensions of the single Layer of the Zone Grouping.

groupingIndex int

The index of the World Grouping which contains the World Cell in question.

worldCell WorldCell

When this method returns, contains the World Cell associated with the Endless Grid Cell, or null if a World Cell cannot be identified

Returns

bool
A bool indicating whether the World Cell was able to be retrieved.

Exceptions

Type Condition
UninitializedSAMObjectException Thrown when this method is called before the World has been initialized.

UnloadWorldRegion(int)

public void UnloadWorldRegion(int worldRegionNumber)

Unloads the World Region matching the input worldRegionNumber.

This method will not give you any insight into when the cells are actually unloaded. If you need to know when the World has processed the World Region and updated itself to reflect changes resulting from the World Region being unloaded, you can register a callback method with the World via the RegisterOnUserRequestsFulfilledCallback method. The callback method will be invoked once the World has completed an update cycle containing changes that resulted from the unload operation.

This strategy also allows you to load and unload multiple regions in one World Update cycle, and be notified when all regions are loaded and/or unloaded. To do so, simply call the LoadWorldRegion and UnloadWorldRegion methods for each region that you want to load or unload before calling the WaitForUpdateThatIncludesRequests method.

Parameters

Name Type Description
worldRegionNumber int

The number of the World Region to unload (you can find this number in the World Inspector, before each World Region Name).


UnloadWorldRegion(string)

public void UnloadWorldRegion(string worldRegionName)

Unloads the cells in the World Region matching the input worldRegionName.

This method will not give you any insight into when the cells are actually unloaded. If you need to know when the World has processed the World Region and updated itself to reflect changes resulting from the World Region being unloaded, you can register a callback method with the World via the RegisterOnUserRequestsFulfilledCallback method. The callback method will be invoked once the World has completed an update cycle containing changes that resulted from the unload operation.

This strategy also allows you to load and unload multiple regions in one World Update cycle, and be notified when all regions are loaded and/or unloaded. To do so, simply call the LoadWorldRegion and UnloadWorldRegion methods for each region that you want to load or unload before calling the WaitForUpdateThatIncludesRequests method.

Parameters

Name Type Description
worldRegionName string

The name of the World Region to unload.


UpdateLoadCushion(double)

public void UpdateLoadCushion(double newLoadCushion)

Updates the Load Cushion used by the World.

The load cushion is the amount of time the World will wait after it receives cell add/remove request or a world origin reset order before proceeding with a World Update or Origin Reset. Increasing the load cushion time gives your player time cross additional boundaries before the world is updated, or to cross back over a boundary that they just crossed. This can reduce some loading/unloading that occurs as the result of a very fast moving player or small terrain/object sizes.

Parameters

Name Type Description
newLoadCushion double

The new load cushion, in seconds.