Skip to content

TileData

Eduard Gushchin edited this page Jul 1, 2026 · 3 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.TileData
Namespace Electron2D
Kind class
Category Rendering

Overview

Stores per-tile metadata consumed by Electron2D.TileMapLayer.

Syntax

public sealed class Electron2D.TileData : Electron2D.Object

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: TileData

Tile metadata resource with modulation, texture origin, z-index and per-layer collision polygon settings.

Remarks

TileData contains the rendering modulation and collision polygon metadata for a tile entry inside a Electron2D.TileSetAtlasSource.

Thread Safety

This type is not synchronized. Create and mutate tile data on the main scene thread or during loading.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileMapLayer
  • Electron2D.TileSetAtlasSource

Members

Member Kind Summary
Modulate Property Gets or sets the color multiplied into the tile draw command.
TextureOrigin Property Gets or sets the visual offset applied to this tile inside its cell.
ZIndex Property Gets or sets the z-index offset for this tile.
Electron2D.TileData() Constructor Initializes a new instance of the Electron2D.TileData type.
GetCollisionPolygonOneWayMargin(System.Int32, System.Int32) Method Gets the one-way collision margin for a polygon.
GetCollisionPolygonPoints(System.Int32, System.Int32) Method Gets the points for a collision polygon.
GetCollisionPolygonsCount(System.Int32) Method Gets the number of collision polygons in a collision layer.
IsCollisionPolygonOneWay(System.Int32, System.Int32) Method Checks whether a collision polygon is one-way.
SetCollisionPolygonOneWay(System.Int32, System.Int32, System.Boolean) Method Sets whether a collision polygon is one-way.
SetCollisionPolygonOneWayMargin(System.Int32, System.Int32, System.Single) Method Sets the one-way collision margin for a polygon.
SetCollisionPolygonPoints(System.Int32, System.Int32, Electron2D.Vector2[]) Method Sets the points for a collision polygon.
SetCollisionPolygonsCount(System.Int32, System.Int32) Method Sets the number of collision polygons stored in a collision layer.

Member Details

Modulate

Kind: Property

public Electron2D.Color Modulate { get; set; }

Summary

Gets or sets the color multiplied into the tile draw command.

Remarks

The value is combined with the owning layer's inherited canvas modulation during rendering.

Value

The color multiplied into this tile; the default value is Electron2D.Color.White.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileMapLayer

TextureOrigin

Kind: Property

public Electron2D.Vector2 TextureOrigin { get; set; }

Summary

Gets or sets the visual offset applied to this tile inside its cell.

Remarks

TileMapLayer adds this value to the destination rectangle position when it submits the tile for rendering.

Value

The local offset in pixels from the cell's top-left corner.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileMapLayer.MapToLocal(Electron2D.Vector2I)

ZIndex

Kind: Property

public System.Int32 ZIndex { get; set; }

Summary

Gets or sets the z-index offset for this tile.

Remarks

This preview uses the value when ordering submitted tile commands inside the canvas render queue.

Value

The z-index offset added to the owning TileMapLayer.ZIndex.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CanvasItem.ZIndex

Electron2D.TileData()

Kind: Constructor

public Electron2D.TileData()

Summary

Initializes a new instance of the Electron2D.TileData type.

Remarks

New tile data starts with white modulation, zero texture origin, zero z-index and no collision polygons.

Thread Safety

This constructor is not synchronized. Call it from the thread that owns the resource being created.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileSetAtlasSource.CreateTile(Electron2D.Vector2I,Electron2D.Vector2I)

GetCollisionPolygonOneWayMargin(System.Int32, System.Int32)

Kind: Method

public System.Single GetCollisionPolygonOneWayMargin(System.Int32, System.Int32)(System.Int32 layerId, System.Int32 polygonIndex)

Summary

Gets the one-way collision margin for a polygon.

Remarks

New collision polygons use a margin of 1.

Parameters

  • layerId: The collision layer metadata id.
  • polygonIndex: The polygon index inside the layer.

Returns

The stored one-way collision margin.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the layer or polygon index is invalid.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileData.SetCollisionPolygonOneWayMargin(System.Int32,System.Int32,System.Single)

GetCollisionPolygonPoints(System.Int32, System.Int32)

Kind: Method

public Electron2D.Vector2[] GetCollisionPolygonPoints(System.Int32, System.Int32)(System.Int32 layerId, System.Int32 polygonIndex)

Summary

Gets the points for a collision polygon.

Remarks

The returned array can be modified by the caller without mutating this tile data. Use Electron2D.TileData.SetCollisionPolygonPoints(System.Int32,System.Int32,Electron2D.Vector2[]) to store changes.

Parameters

  • layerId: The collision layer metadata id.
  • polygonIndex: The polygon index inside the layer.

Returns

A new array containing the polygon points.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the layer or polygon index is invalid.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileData.SetCollisionPolygonPoints(System.Int32,System.Int32,Electron2D.Vector2[])

GetCollisionPolygonsCount(System.Int32)

Kind: Method

public System.Int32 GetCollisionPolygonsCount(System.Int32)(System.Int32 layerId)

Summary

Gets the number of collision polygons in a collision layer.

Remarks

Missing layers report 0.

Parameters

  • layerId: The collision layer metadata id.

Returns

The number of polygons stored in the layer.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when layerId is negative.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileData.SetCollisionPolygonsCount(System.Int32,System.Int32)

IsCollisionPolygonOneWay(System.Int32, System.Int32)

Kind: Method

public System.Boolean IsCollisionPolygonOneWay(System.Int32, System.Int32)(System.Int32 layerId, System.Int32 polygonIndex)

Summary

Checks whether a collision polygon is one-way.

Remarks

Missing or invalid polygons are not treated as one-way polygons.

Parameters

  • layerId: The collision layer metadata id.
  • polygonIndex: The polygon index inside the layer.

Returns

true when the polygon is one-way; otherwise, false.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the layer or polygon index is invalid.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileData.SetCollisionPolygonOneWay(System.Int32,System.Int32,System.Boolean)

SetCollisionPolygonOneWay(System.Int32, System.Int32, System.Boolean)

Kind: Method

public System.Void SetCollisionPolygonOneWay(System.Int32, System.Int32, System.Boolean)(System.Int32 layerId, System.Int32 polygonIndex, System.Boolean oneWay)

Summary

Sets whether a collision polygon is one-way.

Remarks

The managed movement baseline uses this flag for downward movement against tile polygons.

Parameters

  • layerId: The collision layer metadata id.
  • polygonIndex: The polygon index inside the layer.
  • oneWay: Whether the polygon should block only from one side.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the layer or polygon index is invalid.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileData.IsCollisionPolygonOneWay(System.Int32,System.Int32)

SetCollisionPolygonOneWayMargin(System.Int32, System.Int32, System.Single)

Kind: Method

public System.Void SetCollisionPolygonOneWayMargin(System.Int32, System.Int32, System.Single)(System.Int32 layerId, System.Int32 polygonIndex, System.Single margin)

Summary

Sets the one-way collision margin for a polygon.

Remarks

Higher values make one-way collision more tolerant for fast downward movement.

Parameters

  • layerId: The collision layer metadata id.
  • polygonIndex: The polygon index inside the layer.
  • margin: The non-negative margin in local units.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the layer, polygon index or margin is invalid.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileData.GetCollisionPolygonOneWayMargin(System.Int32,System.Int32)

SetCollisionPolygonPoints(System.Int32, System.Int32, Electron2D.Vector2[])

Kind: Method

public System.Void SetCollisionPolygonPoints(System.Int32, System.Int32, Electron2D.Vector2[])(System.Int32 layerId, System.Int32 polygonIndex, Electron2D.Vector2[] polygon)

Summary

Sets the points for a collision polygon.

Remarks

The runtime physics baseline uses the AABB of these points for direct queries and body movement.

Parameters

  • layerId: The collision layer metadata id.
  • polygonIndex: The polygon index inside the layer.
  • polygon: The polygon points in cell-local coordinates.

Exceptions

  • System.ArgumentNullException: Thrown when polygon is null.
  • System.ArgumentOutOfRangeException: Thrown when the layer or polygon index is invalid.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileData.GetCollisionPolygonPoints(System.Int32,System.Int32)

SetCollisionPolygonsCount(System.Int32, System.Int32)

Kind: Method

public System.Void SetCollisionPolygonsCount(System.Int32, System.Int32)(System.Int32 layerId, System.Int32 polygonsCount)

Summary

Sets the number of collision polygons stored in a collision layer.

Remarks

Increasing the count creates empty polygons. Decreasing the count removes polygons at the end of the layer.

Parameters

  • layerId: The collision layer metadata id.
  • polygonsCount: The number of polygons to keep in the layer.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when layerId or polygonsCount is negative.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.TileData.GetCollisionPolygonsCount(System.Int32)

Clone this wiki locally