TileData
Settings for a single tile in a TileSet.
Settings for a single tile in a TileSet.
TileData object represents a single tile in a TileSet. It is usually edited using the tileset editor, but it can be modified at runtime using TileMapLayer._TileDataRuntimeUpdate.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
TileDataConstructor
public TileData();Properties11
FlipHProperty
public bool FlipH { get; set; }If true, the tile will have its texture flipped horizontally.
FlipVProperty
public bool FlipV { get; set; }If true, the tile will have its texture flipped vertically.
MaterialProperty
public Material Material { get; set; }The Material to use for this TileData. This can be a CanvasItemMaterial to use the default shader, or a ShaderMaterial to use a custom shader.
ModulateProperty
public Color Modulate { get; set; }Color modulation of the tile.
ProbabilityProperty
public float Probability { get; set; }Relative probability of this tile being selected when drawing a pattern of random tiles.
TerrainProperty
public int Terrain { get; set; }ID of the terrain from the terrain set that the tile uses.
TerrainSetProperty
public int TerrainSet { get; set; }ID of the terrain set that the tile uses.
TextureOriginProperty
public Vector2I TextureOrigin { get; set; }Offsets the position of where the tile is drawn.
TransposeProperty
public bool Transpose { get; set; }If true, the tile will display transposed, i.e. with horizontal and vertical texture UVs swapped.
YSortOriginProperty
public int YSortOrigin { get; set; }Vertical point of the tile used for determining y-sorted order.
ZIndexProperty
public int ZIndex { get; set; }Ordering index of this tile, relative to TileMapLayer.
Methods57
AddCollisionPolygonvoid
public void AddCollisionPolygon(int layerId);Adds a collision polygon to the tile on the given TileSet physics layer.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
AddOccluderPolygonvoid
public void AddOccluderPolygon(int layerId);Adds an occlusion polygon to the tile on the TileSet occlusion layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
GetCollisionPolygonOneWayMarginfloat
public float GetCollisionPolygonOneWayMargin(int layerId, int polygonIndex);Returns the one-way margin (for one-way platforms) of the polygon at index polygon_index for TileSet physics layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonIndex | int | — |
floatGetCollisionPolygonPointsVector2[]
public Vector2[] GetCollisionPolygonPoints(int layerId, int polygonIndex);Returns the points of the polygon at index polygon_index for TileSet physics layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonIndex | int | — |
Vector2[]GetCollisionPolygonsCountint
public int GetCollisionPolygonsCount(int layerId);Returns how many polygons the tile has for TileSet physics layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
intGetConstantAngularVelocityfloat
public float GetConstantAngularVelocity(int layerId);Returns the constant angular velocity applied to objects colliding with this tile.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
floatGetConstantLinearVelocityVector2
public Vector2 GetConstantLinearVelocity(int layerId);Returns the constant linear velocity applied to objects colliding with this tile.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
Vector2GetCustomDataVariant
public Variant GetCustomData(string layerName);Reads a Variant from a named TileSet custom-data layer. Define the layer and its type in TileSet first. This is tile-type metadata; a walkable value does not itself enable navigation or disable physics shapes.
| Name | Type | Default |
|---|---|---|
layerName | string | — |
layerNameExact name of an existing custom-data layer, not a cell ID. Use HasCustomData when existence is uncertain.
VariantThe Variant value. Use AsBool for the sample boolean layer after validating data. A missing name reports an engine error and returns Nil; do not silently treat Nil as valid false.
GetCustomDataByLayerIdVariant
public Variant GetCustomDataByLayerId(int layerId);Returns the custom data value for custom data layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
VariantGetFlipHbool
public bool GetFlipH();boolGetFlipVbool
public bool GetFlipV();boolGetMaterialMaterial
public Material GetMaterial();MaterialGetModulateColor
public Color GetModulate();ColorGetNavigationPolygon2 overloads
public NavigationPolygon GetNavigationPolygon(int _UnnamedArg0);Returns the navigation polygon of the tile for the TileSet navigation layer with index layer_id.
TileData.FlipH, TileData.FlipV, and TileData.Transpose allow transforming the returned polygon.
| Name | Type | Default |
|---|---|---|
_UnnamedArg0 | int | — |
NavigationPolygonGetOccluder2 overloads · Includes deprecated
public OccluderPolygon2D GetOccluder(int _UnnamedArg0);Returns the occluder polygon of the tile for the TileSet occlusion layer with index layer_id.
TileData.FlipH, TileData.FlipV, and TileData.Transpose allow transforming the returned polygon.
| Name | Type | Default |
|---|---|---|
_UnnamedArg0 | int | — |
OccluderPolygon2Dpublic OccluderPolygon2D GetOccluder(int layerId, bool flipH = false, bool flipV = false, bool transpose = false);Returns the occluder polygon of the tile for the TileSet occlusion layer with index layer_id.
TileData.FlipH, TileData.FlipV, and TileData.Transpose allow transforming the returned polygon.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
flipH | bool | false |
flipV | bool | false |
transpose | bool | false |
OccluderPolygon2DGetOccluderPolygonOccluderPolygon2D
public OccluderPolygon2D GetOccluderPolygon(int layerId, int polygonIndex, bool flipH = false, bool flipV = false, bool transpose = false);Returns the occluder polygon at index polygon_index from the TileSet occlusion layer with index layer_id.
The TileData.FlipH, TileData.FlipV, and TileData.Transpose parameters can be true to transform the returned polygon.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonIndex | int | — |
flipH | bool | false |
flipV | bool | false |
transpose | bool | false |
OccluderPolygon2DGetOccluderPolygonsCountint
public int GetOccluderPolygonsCount(int layerId);Returns the number of occluder polygons of the tile in the TileSet occlusion layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
intGetProbabilityfloat
public float GetProbability();floatGetTerrainint
public int GetTerrain();intGetTerrainPeeringBitint
public int GetTerrainPeeringBit(TileSet.CellNeighbor peeringBit);Returns the tile's terrain bit for the given peering_bit direction. To check that a direction is valid, use TileData.IsValidTerrainPeeringBit.
| Name | Type | Default |
|---|---|---|
peeringBit | TileSet.CellNeighbor | — |
intGetTerrainSetint
public int GetTerrainSet();intGetTextureOriginVector2I
public Vector2I GetTextureOrigin();Vector2IGetTransposebool
public bool GetTranspose();boolGetYSortOriginint
public int GetYSortOrigin();intGetZIndexint
public int GetZIndex();intHasCustomDatabool
public bool HasCustomData(string layerName);Returns whether there exists a custom data layer named layer_name.
| Name | Type | Default |
|---|---|---|
layerName | string | — |
boolIsCollisionPolygonOneWaybool
public bool IsCollisionPolygonOneWay(int layerId, int polygonIndex);Returns whether one-way collisions are enabled for the polygon at index polygon_index for TileSet physics layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonIndex | int | — |
boolIsValidTerrainPeeringBitbool
public bool IsValidTerrainPeeringBit(TileSet.CellNeighbor peeringBit);Returns whether the given peering_bit direction is valid for this tile.
| Name | Type | Default |
|---|---|---|
peeringBit | TileSet.CellNeighbor | — |
boolRemoveCollisionPolygonvoid
public void RemoveCollisionPolygon(int layerId, int polygonIndex);Removes the polygon at index polygon_index for TileSet physics layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonIndex | int | — |
RemoveOccluderPolygonvoid
public void RemoveOccluderPolygon(int layerId, int polygonIndex);Removes the polygon at index polygon_index for TileSet occlusion layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonIndex | int | — |
SetCollisionPolygonOneWayvoid
public void SetCollisionPolygonOneWay(int layerId, int polygonIndex, bool oneWay);Enables/disables one-way collisions on the polygon at index polygon_index for TileSet physics layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonIndex | int | — |
oneWay | bool | — |
SetCollisionPolygonOneWayMarginvoid
public void SetCollisionPolygonOneWayMargin(int layerId, int polygonIndex, float oneWayMargin);Sets the one-way margin (for one-way platforms) of the polygon at index polygon_index for TileSet physics layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonIndex | int | — |
oneWayMargin | float | — |
SetCollisionPolygonPoints2 overloads
public void SetCollisionPolygonPoints(int layerId, int polygonIndex, Vector2[] polygon);Sets the points of the polygon at index polygon_index for TileSet physics layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonIndex | int | — |
polygon | Vector2[] | — |
public void SetCollisionPolygonPoints(int layerId, int polygonIndex, ReadOnlySpan<Vector2> polygon);Sets the points of the polygon at index polygon_index for TileSet physics layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonIndex | int | — |
polygon | ReadOnlySpan<Vector2> | — |
SetCollisionPolygonsCountvoid
public void SetCollisionPolygonsCount(int layerId, int polygonsCount);Sets the polygons count for TileSet physics layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonsCount | int | — |
SetConstantAngularVelocityvoid
public void SetConstantAngularVelocity(int layerId, float velocity);Sets the constant angular velocity. This does not rotate the tile. This angular velocity is applied to objects colliding with this tile.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
velocity | float | — |
SetConstantLinearVelocityvoid
public void SetConstantLinearVelocity(int layerId, Vector2 velocity);Sets the constant linear velocity. This does not move the tile. This linear velocity is applied to objects colliding with this tile. This is useful to create conveyor belts.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
velocity | Vector2 | — |
SetCustomDatavoid
public void SetCustomData(string layerName, Variant value);Sets the tile's custom data value for the TileSet custom data layer with name layer_name.
| Name | Type | Default |
|---|---|---|
layerName | string | — |
value | Variant | — |
SetCustomDataByLayerIdvoid
public void SetCustomDataByLayerId(int layerId, Variant value);Sets the tile's custom data value for the TileSet custom data layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
value | Variant | — |
SetFlipHvoid
public void SetFlipH(bool flipH);| Name | Type | Default |
|---|---|---|
flipH | bool | — |
SetFlipVvoid
public void SetFlipV(bool flipV);| Name | Type | Default |
|---|---|---|
flipV | bool | — |
SetMaterialvoid
public void SetMaterial(Material material);| Name | Type | Default |
|---|---|---|
material | Material | — |
SetModulatevoid
public void SetModulate(Color modulate);| Name | Type | Default |
|---|---|---|
modulate | Color | — |
SetNavigationPolygonvoid
public void SetNavigationPolygon(int layerId, NavigationPolygon navigationPolygon);Sets the navigation polygon for the TileSet navigation layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
navigationPolygon | NavigationPolygon | — |
SetOccludervoid · Deprecated
public void SetOccluder(int layerId, OccluderPolygon2D occluderPolygon);Sets the occluder for the TileSet occlusion layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
occluderPolygon | OccluderPolygon2D | — |
SetOccluderPolygonvoid
public void SetOccluderPolygon(int layerId, int polygonIndex, OccluderPolygon2D polygon);Sets the occluder for polygon with index polygon_index in the TileSet occlusion layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonIndex | int | — |
polygon | OccluderPolygon2D | — |
SetOccluderPolygonsCountvoid
public void SetOccluderPolygonsCount(int layerId, int polygonsCount);Sets the occluder polygon count in the TileSet occlusion layer with index layer_id.
| Name | Type | Default |
|---|---|---|
layerId | int | — |
polygonsCount | int | — |
SetProbabilityvoid
public void SetProbability(float probability);| Name | Type | Default |
|---|---|---|
probability | float | — |
SetTerrainvoid
public void SetTerrain(int terrain);| Name | Type | Default |
|---|---|---|
terrain | int | — |
SetTerrainPeeringBitvoid
public void SetTerrainPeeringBit(TileSet.CellNeighbor peeringBit, int terrain);Sets the tile's terrain bit for the given peering_bit direction. To check that a direction is valid, use TileData.IsValidTerrainPeeringBit.
| Name | Type | Default |
|---|---|---|
peeringBit | TileSet.CellNeighbor | — |
terrain | int | — |
SetTerrainSetvoid
public void SetTerrainSet(int terrainSet);| Name | Type | Default |
|---|---|---|
terrainSet | int | — |
SetTextureOriginvoid
public void SetTextureOrigin(Vector2I textureOrigin);| Name | Type | Default |
|---|---|---|
textureOrigin | Vector2I | — |
SetTransposevoid
public void SetTranspose(bool transpose);| Name | Type | Default |
|---|---|---|
transpose | bool | — |
SetYSortOriginvoid
public void SetYSortOrigin(int ySortOrigin);| Name | Type | Default |
|---|---|---|
ySortOrigin | int | — |
SetZIndexvoid
public void SetZIndex(int zIndex);| Name | Type | Default |
|---|---|---|
zIndex | int | — |
Signals and events1
ChangedEvent
public event Action Changed;Emitted when any of the properties are changed.