- Modificato
Saving Runtime Repacking result to build NPCs
We've got a decent customization system set up here with the Runtime Repacking setup. Pretty cool. It occurred to me, that it would be pretty neat if we could turn this into a tool to build lots of NPCs in the game.
I can pretty easily save the repacked atlas somewhere if we're running the game in the Unity Editor, but I'm unsure about the skin data. Any ideas here? Skin.cs is not serializable, but perhaps there's some bit of code in the runtime that can reserialize the Skeleton into a json blob?
Currently, we don't have this tool out of the box. Also, no part of our code writes json.
You wouldn't need to store it as json. It could just as well be a Unity ScriptableObjects if you want to go that route. A Skin is primarily just a dictionary of skin entries. If you read the Skin class, it's pretty straightforward. Just need to rewire it at loadtime since it does store Attachment objects which don't exist until after the Skeleton data has been loaded.
If you wanted to serialize attachments too, that is likely also doable via Unity ScriptableObjects.
You're probably already aware of this if you were doing custom skins. But for the benefit of other users, here's a link for more on how it works: Spine-Unity Mix and Match