Fixing Unity's ArgumentNullException for null atlases parameter in atlas packing
A Unity editor batch routine throws ArgumentNullException when calling SpriteAtlasUtility.PackAtlases because the atlases argument is null. The error typically occurs after a folder scan under Assets/Art/Atlases finds no matching SpriteAtlas assets, leaving the collection reference uninitialized. The exception is raised by a guard in the editor binding before any packing begins, so no partial pack is produced. The suggested fix is to build the array from an initialized list, verify assets load through AssetDatabase, and check for null or empty results before calling the packing utility. A sample editor script demonstrates this guarded approach.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in