This bug is getting very annoying, so I chose to make a new thread about it. The old thread was (mostly) about a different issue.
Of all things this bugs me the most (pun intended). I’m now in 5.3.2p3 and I get "Cannot load Atlas [ATLASNAME] During Build/Enter Game. Please rebuild Sprite Atlas." several times a day, always when I change build target and basically most of time I touch any of the sprites I have. It doesn’t matter if you run the game, build it or just repack from SpritePacker: the error appears and one or more atlases break. After that point it will always complain about those atlases, spamming the same error hundreds of times when I start playmode in the editor.
Workaround is to quit Unity, delete the AtlasCache folder and restart. These wasted minutes add up quickly… This has been happening since 5.2 days at least, I think it was not in 5.1.x. I’m running Windows 10, I have not seen this on Mac (although I use it only for iOS work occasionally), so I’m assuming it’s Windows-only problem.
I tried to reproduce this with a clean project for 1.5 hours, and could not make it happen. I copied all my sprites and their settings, atlases are basically the same but no luck getting the error reproduced so I could not make a bug report.
Anyone else getting this? Maybe we can narrow things down by searching for common things in the projects / systems this happens on.
@Venkify I’ll send you PM with link to the editor log file. It was broken earlier yesterday, I switched platforms and gathered more logs in case there’s something in there. It seems to occasionally spam the same error message dozens of times.
Then I closed Unity, deleted the AtlasCache and restarted, trying to gather the reproduction steps. But of course I couldn’t get it to error out! I tried switching between Android and standalone, doing some sprite changes but nothing. Usually when I’m working on sprites it will break out eventually and then one or two atlases will get broken somehow, and it will then complain about them until I clear the cache… I can grab more logs when the error appears again, but I suspect there isn’t anything new that isn’t in the one I’ll send you…
Ran into this issue just this evening. I’d be testing a windows build and then switched to an Android build. The android build threw an error for each atlas. I blew away the atlas cache folders, packed, and the errors went away.
Yeah it’s most probably related to Android build target, either switching to or from it. The errors seem to appear after the packing is done while “Assigning cache references…” operation is in progress.
We get this constantly on 5.3.4 even when not switching atlas. It is annoying, have to continuously delete the Atlas folder, repack the sprites…then it works for a while and breaks again. Have about 10 atlases, defaultSpritePackerPolicy, iOS platform for Editor under OSX
Ok so it’s not only on Windows then! I haven’t seen it on OS X myself, but then again I only work there when I do my iOS builds, very occasionally. And yeah, I get it without switching platforms sometimes, but very often when doing the switch.
@bitbiome_llc , @KB73 , can you reproduce it on a small project? I’ve been unsuccessful.
Confirmed on OSX El Capitan Unity 5.3.4 while switching Android build too… first I do ETC1 which is fine, but then switch to ETC2 and this happen. (and then continue to happen when switch to DXT, PVRTC)
For the time being I wrote this script that automatically delete your AtlasCache folder every time you finish the build. I hope it got fixed for real soon.
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.IO;
using System.Collections;
public class PostBuildAtlasCacheClear : MonoBehaviour {
[PostProcessBuild]
private static void DeleteAtlasCache(BuildTarget target, string pathToBuiltProject)
{
string projectPath = Application.dataPath; //Asset path
string atlasCachePath = Path.GetFullPath(Path.Combine(projectPath, Path.DirectorySeparatorChar + ".." + Path.DirectorySeparatorChar + "Library" + Path.DirectorySeparatorChar + "AtlasCache"));
Directory.Delete(atlasCachePath,true);
Debug.Log("Deleted atlas cache folder.");
}
}
#endif
I hope so too, this the most annoying Unity bug I’ve ever encountered, plaguing me since last Fall, I think.
Btw does it work for you if you delete the AtlasCache and won’t restart Unity after that? I always restart after deleting it, then repack, which wastes even more time… I think I tried without restart once but it didn’t work, have to check again…
Yes it works without restarting. I build like six times in one session for all formats. I guess there’s no problem since now they are all already live and no users has complained (yet)…
Alright, have to try without a restart next time it happens. Shoulnd’t take too long.
Btw I did get this problem on my Mac a few days back, first time I saw this on OS X. I didn’t even switch platforms, it’s always set to iOS build target there.
Just adding myself to the list; I find this irritating as well. Would like to see it fixed, but it’s been a problem for so long I’m not sure anyone cares about it, really.