Method TryGetLayer
TryGetLayer(int, out TilemapLayer?)
Get the TilemapLayer element at the specified index in this Tilemap.
public bool TryGetLayer(int index, out TilemapLayer? layer)
Parameters
index
intThe index of the TilemapLayer element to locate.
layer
TilemapLayerWhen this method returns true, contains the TilemapLayer element located; otherwise, null.
Returns
- bool
true if a TilemapLayer element was located at the specified index in this Tilemap; otherwise, false. This method return false when the specified index is less than zero or is greater than or equal to the total number of TilemapLayer elements in this Tilemap.
TryGetLayer(string, out TilemapLayer?)
Gets the TilemapLayer element with the specified name in this Tilemap.
public bool TryGetLayer(string name, out TilemapLayer? layer)
Parameters
name
stringThe name of the TilemapLayer element to locate.
layer
TilemapLayerWhen this method returns true, contains the TilemapLayer element located; otherwise, null.
Returns
- bool
true if a TilemapLayer element was located in this Tilemap with the specified name; otherwise false. This method returns false if this Tilemap does not contain a TilemapLayer element with the specified name.