Enabling Sprite Atlas makes switching to play mode very slow

Hello Everyone

Using sprite atlases greatly improves the performances of my project, both in editor and in build. However, setting Sprite Packer mode to “Sprite Atlas V2 - Enable” into the project settings cause entering the play mode to be very slow every times.

I don’t think this is caused by atlas packing. I create the atlases by code and I pack them at creation by calling SpriteAtlasUtility.PackAtlases(). And I don’t see any loading bar when entering play mode. Instead, it looks like Unity is checking if the atlas changed and this is what’s taking so long.

I checked into the profiler and this is what I got:


As you can see SpriteAtlasManager.OnEnterPlayModePreAwake() is taking an awfully long time, with 4361868 calls to GetPathFromAssetGuid(). There is clearly something wrong here. For this test I have only one atlas with 800 sprites. Is this too much for Unity?

I couldn’t find the code for SpriteAtlasManager.OnEnterPlayModePreAwake(). Does anyone knows what it does? Can I see the code anywhere? Is there any way to fix this issue? My atlases are not going to change after creation. Is there a way to tell Unity not to check them?

Should I report a bug about this?

Thank you very much.

1 Like