cocos_create_sprite_atlas
Automatically pack multiple sprite-frame PNGs into a single atlas texture during Cocos Creator builds, eliminating manual enumeration and simplifying game asset management.
Instructions
Create an AutoAtlas bundle (Cocos 3.8 build-time packing).
Drops a <atlas_name>.pac marker + correct meta into a folder
(default assets/atlas/<name>/). From that point on, every
sprite-frame PNG in that folder is automatically packed into
one atlas texture when cocos_build runs — no manual
enumeration needed afterward.
png_paths is optional. If provided, the PNGs are copied into
the atlas folder + sprite-frame metas are written. For PNGs
already in the folder (e.g. cocos_add_image(rel_path=
"assets/atlas/<name>/foo.png")), no copy is required; they
are picked up at build time automatically.
Tunables (all match Cocos Creator 3.8 defaults):
max_width/max_height— atlas texture size cap (1024).padding— gap between frames in px (2).power_of_two— force ^2 sizes; usually off.force_squared— force 1:1 aspect; usually off.filter_unused— drop unreferenced sprite frames from the final bundle.algorithm—"MaxRects"(default) or"Basic".quality— 0-100 PNG quality.
Returns {dir, atlas_uuid, pac_path, images, atlas_dir_rel}.
atlas_dir_rel is the project-relative folder — drop more
PNGs there later to add them to the atlas without running this
tool again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | ||
| atlas_name | Yes | ||
| png_paths | No | ||
| rel_dir | No | ||
| max_width | No | ||
| max_height | No | ||
| padding | No | ||
| power_of_two | No | ||
| force_squared | No | ||
| filter_unused | No | ||
| algorithm | No | MaxRects | |
| quality | No |