Skip to content
Download
API reference

AtlasTexture

Inherits: Texture2D < Texture < Resource < Shared < Object

A texture that crops out part of another Texture2D.

Texture2D resource that draws only part of its atlas texture, as defined by the region. An additional margin can also be set, which is useful for small adjustments.

Multiple AtlasTexture resources can be cropped from the same atlas. Packing many smaller textures into a singular large texture helps to optimize video memory costs and render calls.

Note: AtlasTexture will not tile properly in actors such as TextureRect or Sprite2D. To tile an AtlasTexture, modify its region instead.

TypeNameDefault
Texture2Datlas
boolfilter_clipfalse
Rect2marginRect2(0, 0, 0, 0)
Rect2regionRect2(0, 0, 0, 0)
boolresource_local_to_scenefalse

Texture2D atlas

Setter/getter: set_atlas(), get_atlas()

The texture that contains the atlas. Can be any type inheriting from Texture2D, including another AtlasTexture.

bool filter_clip = false

Setter/getter: set_filter_clip(), has_filter_clip()

If true, the area outside of the region is clipped to avoid bleeding of the surrounding texture pixels.

Rect2 margin = Rect2(0, 0, 0, 0)

Setter/getter: set_margin(), get_margin()

The margin around the region. Useful for small adjustments. If the Rect2.size of this property (“w” and “h” in the editor) is set, the drawn texture is resized to fit within the margin.

Rect2 region = Rect2(0, 0, 0, 0)

Setter/getter: set_region(), get_region()

The region used to draw the atlas. If either dimension of the region’s size is 0, the value from atlas size will be used for that axis instead.

Note: The image size is always an integer, so the actual region size is rounded down.

bool resource_local_to_scene = false

Setter/getter: set_local_to_scene(), is_local_to_scene()

No description yet.