- Home /
.spriteatlas hash is recalculate to another value very often.
I am using new sprite atlas feature that is built in since Unity2017.
It will works almost fine. But there contains hash numbers are recalculate very often. It represented when even i didn't modified anything. I just played the editor.
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!687078895 &4343727234628468602
SpriteAtlas:
m_ObjectHideFlags: 0
.... lines ....
packedHash:
serializedVersion: 2
Hash: f2629172dcecfa8f7bdf787bd034f4df
.... lines ....
hashString: f2629172dcecfa8f7bdf787bd034f4df
.... lines ....
This is part of .spriteatlas asset file contents. You could see two lines of hash number that issues.
I have a question. When does Unity modifies that hash numbers? And what are these hashes generated based on?
Best Regards.
Answer by okuligowski_huuuge · Oct 09, 2017 at 07:24 AM
I have the same issue.
I think hash is based on a target platform. This could mean that if 1 dev is working on Android and other on iOS, then both programmers will override each others hashes on a repository. But thats just my theory.
Answer by Benzor · Nov 06, 2017 at 08:07 PM
Unity regenerates the hash every time the sprite atlases are repacked. Presumably the packing process is non-deterministic, meaning every time it repacks, you'll get a slightly different atlas and with a different hash.
Check your project editor settings (Edit > Project Settings > Editor), and under Sprite Packer > Mode you most likely have the setting Always Enabled . This is fine if you want to test your sprite atlas packing in the editor so you can debug sprite batching issues or similar, but it's not necessary to permanently work this way. Change it to Enabled For Builds and it will only repack the sprite atlases when you perform a build. This will minimize changes for your version control.
This doesn't help much since every time a build is done, the file will be marked as changed in source control. Any other ideas?
I agree, it's annoying and it's something Unity should fix. As a workaround though, you can write a batch script which runs your build using Unity's command line client, then clears out any uncommitted changes. Just make sure to commit any important changes before running it!
A Unity guy said it's fixed, but I still got it in 2017.3.1f1....
Your answer

Follow this Question
Related Questions
How do I use the sprite packer sprites after packing? 0 Answers
Textures with Packing Tag exported alone 1 Answer
Sprite Packer also include original sprite in build 0 Answers
New asset bundles variants (5) and Unity UI spritePacker 1 Answer
AssetPostprocessor, AssetImporter set spritePackingTag invalid, Can't change texture meta. 0 Answers