Spine in Unity: The given key 'hash' was not present in the dictionary
- spine-csharp (Unity)
KeyNotFoundException: The given key 'hash' was not present in the dictionary.— SkeletonJson.ReadSkeletonData — reads skeleton.hash without a check- spine-ts (web, Phaser, PixiJS)
(no error: the hash is optional)— SkeletonJson.readSkeletonData
The skeleton section of skeleton.json has no hash field. The Spine editor always writes it, so this comes up with files made by a script, a converter or an AI tool — and because the web runtimes treat the field as optional, the same file plays in a browser and fails in Unity.
What the runtime looks up
spine-csharp reads skeleton.hash straight from the dictionary, without checking that the key exists, so a missing key is a KeyNotFoundException and the whole skeleton fails to load. Nothing else uses the value while loading: any string will do.
"skeleton": {
"hash": "09wpjwa0p3jjh5", // any string; missing → Unity fails to load
"spine": "4.2.22",
...
}How to fix it
Add a hash string to the skeleton section, next to spine. If the file comes from a generator, fix the generator: otherwise every new export brings the error back. Riggy writes a hash of the file's content, so it changes when the rig changes.
Check your skeleton
The Spine JSON validator does not look for this one, but checks the rest of the file for the problems the runtime loads silently — slot colors, mesh data, deform keys, bone order. It runs in your browser.