AutoAtlas getSpriteFrames empty during preview

Hi everyone!

Was wondering what the correct procedure for accessing AutoAtlas assets when testing during preview.
After building, AutoAtlas.getSpriteFrame(“spritename”) works correctly, but during preview, the AutoAtlas sprite list is empty.

Is there some other way of accessing the sprites in AutoAtlas that works both in preview and after it is built?

Try adding a video object and in yhe video add the sprite

Hmm, I’m not trying to do an animation or video here, I would just like to retrieve a single sprite from an atlas.

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.

  1. 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?

Currently auto atlas isn’t packed for preview, so it’s empty. The designed procedure is that developers use SpriteFrame assets directly, it will be available in both preview and build mode.

Hmm, what is the best practice for using SpriteFrames that will be compiled into an Auto Atlas later?
Is it best to load them by name dynamically using resources.load (referring to them individually instead of loading the spriteatlas)

eg: resources.load("test assets/image/spriteFrame", SpriteFrame, (err, spriteFrame)
for each spriteframe instead of:
resources.load("test assets/sheep", SpriteAtlas, (err, atlas)
as we cannot refer to the auto atlas?

or is it better to set up an array of spriteframes on a script on the Node and drag each spriteframe into the slot on the cocos creator editor rollout?