Skip to content

Api > Texture2D > PackTextures()


Texture2D.PackTextures(Texture2D[] textures, number padding, number maximumAtlasSize, boolean makeNoLongerReadable)⚓︎

Packs multiple Textures into a texture atlas.

Parameters:⚓︎

Name Type Description
textures Texture2D[] Array of textures to pack into the atlas.
padding number Padding in pixels between the packed textures.
maximumAtlasSize number Maximum size of the resulting texture.
makeNoLongerReadable boolean Should the texture be marked as no longer readable?

Returns:⚓︎

type Description
Rect[] An array of rectangles containing the UV coordinates in the atlas for each input texture, or null if packing fails.

Usage⚓︎

---@type Texture2D
local texture2d;

---@type Texture2D
local textures;

---@type number
local padding;

---@type number
local maximumAtlasSize;

---@type boolean
local makeNoLongerReadable;


local val0 = texture2d.PackTextures(textures, padding, maximumAtlasSize, makeNoLongerReadable)

Extra Detail⚓︎

This function will replace the current texture with the atlas made from the supplied textures. The size, format and mipmaps of any of the textures can change after packing.