As my game (and it’s editor) gets bigger, I find myself moving asset files around quite often to try and keep things tidy and logical. I have a lot of assets, including json data files that refers to assets like this:
{
"Name": "Bob",
"Sprite": "/Heroes/Bob/BobSprite"
}
The problem is, if I move/rename the asset “/Heroes/Bob/BobSprite” to “/Graphics/Heroes/Bob”, this will break everything since the asset path changed and the file is no longer there.
For one file, it’s not too bad and I can go fix it manually but it becomes problematic when moving entire directories. To make things worse, I plan on releasing this editor to the public and I wouldn’t want to ship it in with this kind of issue.
Because of this I was toying with the idea of creating my own tool that would index these assets so that I could refer to them by GUID instead of by path.
[
{"f3750b92-714a-11eb-9439-0242ac130002", "/Heroes/Bob/BobSprite"},
{"d9eccbb5-bca7-4104-bef7-425119d42696", "/Graphics/Characters/Bob"}
...
]
The tool would keep track of file changes and update a Dictionary<Guid, string> so that I could in theory do something like Content.LoadByGUID(data.SpriteID). Since the GUID would be set in stone when the file is first added through the tool, the asset could be moved around without breaking the builds.
This could be quite a big change so I wanted to know your opinion on the matter before diving head first into this rabbit hole. Does it seem insane and/or am I re-inventing the wheel, not knowing this problem has been solved before?
Thanks in advance!