I have several sprites which I would like to combine into an atlas.
If I am to access the sprites individually, I would use cc.loader or a list of references to the sprites in my script. I was hoping to group my sprites under an AutoAtlas, load the atlas, then reference the sprites using Atlas.getSpriteFrame(“spritename”). However, during run time, AutoAtlas.spriteFrames[] is empty, and any code which refers to sprite frames within the atlas will not work.
Is it true that Auto-Atlas CANNOT be referenced or loaded in script? It makes things extremely hard to test if the only way to test is to build the entire project. Yet the manual seems to indicate that we should not bind references to the assets separately.
- When any Texture2D asset depended by SpriteFrame assets in the Atlas asset’s folder is directly used by another asset, the dependent Texture2D asset and Image asset will also be generated.
What would be the proper way to access a spriteframe in an atlas then, while allowing for testing in preview mode?