Skip to main content

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

Packs multiple Textures into a texture atlas.

Parameters:

NameTypeDescription
texturesTexture2D[]Array of textures to pack into the atlas.
paddingnumberPadding in pixels between the packed textures.
maximumAtlasSizenumberMaximum size of the resulting texture.
makeNoLongerReadablebooleanShould the texture be marked as no longer readable?

Returns:

typeDescription
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.