Texture2D.PackTextures 纹理包

function PackTextures (textures : Texture2D[], padding : int, maximumAtlasSize : int = 2048) : Rect[]



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



Packs multiple textures into a texture atlas.


This function will replace current texture with the texture atlas. Size, format and whether the texture has mipmaps can change after packing.

此函数将使用纹理图集替换当前的纹理。纹理大小、格式和纹理是否有 mipmap 在打包后可以更改。

Resulting texture atlas will be as large as needed to fit all input textures, but only up to maximumAtlasSize in each dimension. If all input textures can't fit into texture atlas of such size, they will be scaled down to fit.

生成纹理图集将根据需要尽可能的大以便适合所有纹理,但是不能超过 maximumAtlasSize 中的最大值。如纹理集合不能容纳所输入的纹理,这些纹理将按比例缩小以适合纹理集合。

Texture atlas will have DXT1 format if all input textures are DXT1 compressed. If all input textures are compressed in DXT1 or DXT5 formats, then atlas will be in DXT5 format. If any input texture is not compressed, then atlas will be in ARGB32 uncompressed format.


If none of input textures have mipmaps, then atlas will have no mipmaps as well.


Page last updated: 2010-12-18