TileSetSource
Exposes a set of tiles for a TileSet resource.
Exposes a set of tiles for a TileSet resource.
Exposes a set of tiles for a TileSet resource.
Tiles in a source are indexed with two IDs, coordinates ID (of type Vector2i) and an alternative ID (of type int), named according to their use in the TileSetAtlasSource class.
Depending on the TileSet source type, those IDs might have restrictions on their values, this is why the base TileSetSource class only exposes getters for them.
You can iterate over all tiles exposed by a TileSetSource by first iterating over coordinates IDs using TileSetSource.GetTilesCount and TileSetSource.GetTileId, then over alternative IDs using TileSetSource.GetAlternativeTilesCount and TileSetSource.GetAlternativeTileId.
Warning: TileSetSource can only be added to one TileSet at the same time. Calling TileSet.AddSource on a second TileSet will remove the source from the first one.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Methods6
GetAlternativeTileIdint
public int GetAlternativeTileId(Vector2I atlasCoords, int index);Returns the alternative ID for the tile with coordinates ID atlas_coords at index index.
| Name | Type | Default |
|---|---|---|
atlasCoords | Vector2I | — |
index | int | — |
intGetAlternativeTilesCountint
public int GetAlternativeTilesCount(Vector2I atlasCoords);Returns the number of alternatives tiles for the coordinates ID atlas_coords.
For TileSetAtlasSource, this always return at least 1, as the base tile with ID 0 is always part of the alternatives list.
Returns -1 if there is not tile at the given coords.
| Name | Type | Default |
|---|---|---|
atlasCoords | Vector2I | — |
intGetTileIdVector2I
public Vector2I GetTileId(int index);Returns the tile coordinates ID of the tile with index index.
| Name | Type | Default |
|---|---|---|
index | int | — |
Vector2IGetTilesCountint
public int GetTilesCount();Returns how many tiles this atlas source defines (not including alternative tiles).
intHasAlternativeTilebool
public bool HasAlternativeTile(Vector2I atlasCoords, int alternativeTile);Returns if the base tile at coordinates atlas_coords has an alternative with ID alternative_tile.
| Name | Type | Default |
|---|---|---|
atlasCoords | Vector2I | — |
alternativeTile | int | — |
boolHasTilebool
public bool HasTile(Vector2I atlasCoords);Returns if this atlas has a tile with coordinates ID atlas_coords.
| Name | Type | Default |
|---|---|---|
atlasCoords | Vector2I | — |
bool