Table of Contents

Class TileData

Namespace
Godot
Assembly
GodotSharp.dll

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 _TileDataRuntimeUpdate(int, Vector2I, TileData).

public class TileData : GodotObject, IDisposable
Inheritance
TileData
Implements
Inherited Members

Constructors

TileData()

public TileData()

Properties

FlipH

If true, the tile will have its texture flipped horizontally.

public bool FlipH { get; set; }

Property Value

bool

FlipV

If true, the tile will have its texture flipped vertically.

public bool FlipV { get; set; }

Property Value

bool

Material

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.

public Material Material { get; set; }

Property Value

Material

Modulate

Color modulation of the tile.

public Color Modulate { get; set; }

Property Value

Color

Probability

Relative probability of this tile being selected when drawing a pattern of random tiles.

public float Probability { get; set; }

Property Value

float

Terrain

ID of the terrain from the terrain set that the tile uses.

public int Terrain { get; set; }

Property Value

int

TerrainSet

ID of the terrain set that the tile uses.

public int TerrainSet { get; set; }

Property Value

int

TextureOrigin

Offsets the position of where the tile is drawn.

public Vector2I TextureOrigin { get; set; }

Property Value

Vector2I

Transpose

If true, the tile will display transposed, i.e. with horizontal and vertical texture UVs swapped.

public bool Transpose { get; set; }

Property Value

bool

YSortOrigin

Vertical point of the tile used for determining y-sorted order.

public int YSortOrigin { get; set; }

Property Value

int

ZIndex

Ordering index of this tile, relative to TileMap.

public int ZIndex { get; set; }

Property Value

int

Methods

AddCollisionPolygon(int)

Adds a collision polygon to the tile on the given TileSet physics layer.

public void AddCollisionPolygon(int layerId)

Parameters

layerId int

GetCollisionPolygonOneWayMargin(int, int)

Returns the one-way margin (for one-way platforms) of the polygon at index polygonIndex for TileSet physics layer with index layerId.

public float GetCollisionPolygonOneWayMargin(int layerId, int polygonIndex)

Parameters

layerId int
polygonIndex int

Returns

float

GetCollisionPolygonPoints(int, int)

Returns the points of the polygon at index polygonIndex for TileSet physics layer with index layerId.

public Vector2[] GetCollisionPolygonPoints(int layerId, int polygonIndex)

Parameters

layerId int
polygonIndex int

Returns

Vector2[]

GetCollisionPolygonsCount(int)

Returns how many polygons the tile has for TileSet physics layer with index layerId.

public int GetCollisionPolygonsCount(int layerId)

Parameters

layerId int

Returns

int

GetConstantAngularVelocity(int)

Returns the constant angular velocity applied to objects colliding with this tile.

public float GetConstantAngularVelocity(int layerId)

Parameters

layerId int

Returns

float

GetConstantLinearVelocity(int)

Returns the constant linear velocity applied to objects colliding with this tile.

public Vector2 GetConstantLinearVelocity(int layerId)

Parameters

layerId int

Returns

Vector2

GetCustomData(string)

Returns the custom data value for custom data layer named layerName.

public Variant GetCustomData(string layerName)

Parameters

layerName string

Returns

Variant

GetCustomDataByLayerId(int)

Returns the custom data value for custom data layer with index layerId.

public Variant GetCustomDataByLayerId(int layerId)

Parameters

layerId int

Returns

Variant

GetNavigationPolygon(int)

Returns the navigation polygon of the tile for the TileSet navigation layer with index layerId.

public NavigationPolygon GetNavigationPolygon(int layerId)

Parameters

layerId int

Returns

NavigationPolygon

GetOccluder(int)

Returns the occluder polygon of the tile for the TileSet occlusion layer with index layerId.

public OccluderPolygon2D GetOccluder(int layerId)

Parameters

layerId int

Returns

OccluderPolygon2D

GetTerrainPeeringBit(CellNeighbor)

Returns the tile's terrain bit for the given peeringBit direction.

public int GetTerrainPeeringBit(TileSet.CellNeighbor peeringBit)

Parameters

peeringBit TileSet.CellNeighbor

Returns

int

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsCollisionPolygonOneWay(int, int)

Returns whether one-way collisions are enabled for the polygon at index polygonIndex for TileSet physics layer with index layerId.

public bool IsCollisionPolygonOneWay(int layerId, int polygonIndex)

Parameters

layerId int
polygonIndex int

Returns

bool

RemoveCollisionPolygon(int, int)

Removes the polygon at index polygonIndex for TileSet physics layer with index layerId.

public void RemoveCollisionPolygon(int layerId, int polygonIndex)

Parameters

layerId int
polygonIndex int

SetCollisionPolygonOneWay(int, int, bool)

Enables/disables one-way collisions on the polygon at index polygonIndex for TileSet physics layer with index layerId.

public void SetCollisionPolygonOneWay(int layerId, int polygonIndex, bool oneWay)

Parameters

layerId int
polygonIndex int
oneWay bool

SetCollisionPolygonOneWayMargin(int, int, float)

Enables/disables one-way collisions on the polygon at index polygonIndex for TileSet physics layer with index layerId.

public void SetCollisionPolygonOneWayMargin(int layerId, int polygonIndex, float oneWayMargin)

Parameters

layerId int
polygonIndex int
oneWayMargin float

SetCollisionPolygonPoints(int, int, Vector2[])

Sets the points of the polygon at index polygonIndex for TileSet physics layer with index layerId.

public void SetCollisionPolygonPoints(int layerId, int polygonIndex, Vector2[] polygon)

Parameters

layerId int
polygonIndex int
polygon Vector2[]

SetCollisionPolygonsCount(int, int)

Sets the polygons count for TileSet physics layer with index layerId.

public void SetCollisionPolygonsCount(int layerId, int polygonsCount)

Parameters

layerId int
polygonsCount int

SetConstantAngularVelocity(int, float)

Sets the constant angular velocity. This does not rotate the tile. This angular velocity is applied to objects colliding with this tile.

public void SetConstantAngularVelocity(int layerId, float velocity)

Parameters

layerId int
velocity float

SetConstantLinearVelocity(int, Vector2)

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.

public void SetConstantLinearVelocity(int layerId, Vector2 velocity)

Parameters

layerId int
velocity Vector2

SetCustomData(string, Variant)

Sets the tile's custom data value for the TileSet custom data layer with name layerName.

public void SetCustomData(string layerName, Variant value)

Parameters

layerName string
value Variant

SetCustomDataByLayerId(int, Variant)

Sets the tile's custom data value for the TileSet custom data layer with index layerId.

public void SetCustomDataByLayerId(int layerId, Variant value)

Parameters

layerId int
value Variant

SetNavigationPolygon(int, NavigationPolygon)

Sets the navigation polygon for the TileSet navigation layer with index layerId.

public void SetNavigationPolygon(int layerId, NavigationPolygon navigationPolygon)

Parameters

layerId int
navigationPolygon NavigationPolygon

SetOccluder(int, OccluderPolygon2D)

Sets the occluder for the TileSet occlusion layer with index layerId.

public void SetOccluder(int layerId, OccluderPolygon2D occluderPolygon)

Parameters

layerId int
occluderPolygon OccluderPolygon2D

SetTerrainPeeringBit(CellNeighbor, int)

Sets the tile's terrain bit for the given peeringBit direction.

public void SetTerrainPeeringBit(TileSet.CellNeighbor peeringBit, int terrain)

Parameters

peeringBit TileSet.CellNeighbor
terrain int

Events

Changed

Emitted when any of the properties are changed.

public event Action Changed

Event Type

Action