• Runtimes
  • Using the same assets in Pixi and Spine

Hey,
we are using the same assets in Pixi and Spine and we want to reduce the duplication.

Is it better to:

  1. Have the assets in Pixi (packed with TexturePacker) and use slots in Spine to attach them there?
  2. Have the assets in Spine and use them in Pixi from there as well (if that's even possible)?

If having them in Spine atlas is better, do I have to write some script that would parse the atlas and create a Texture from it to Pixi?

Related Discussions
...

When using the same assets in both Pixi and Spine, you have a couple of options to reduce duplication.

  1. Using Pixi's TexturePacker: You can pack your assets using TexturePacker for Pixi and then use slots in Spine to attach them. This approach allows you to manage your assets primarily in Pixi, which might be beneficial if Pixi is your main rendering engine.

  2. Using Spine's Texture Atlas: You can also use Spine's texture atlas and then load these assets into Pixi. This is possible, but it requires some additional work. You would need to parse the Spine atlas and create textures in Pixi. This involves loading the atlas text file as a text and initializing the TextureAtlas manually. You would then map the page names to the respective base64 data or image files and set the textures accordingly in Pixi.

If you choose to use Spine's atlas, you will indeed need to write a script to parse the atlas and create textures for Pixi. This involves loading the JSON skeleton with Pixi's JSON loader and the atlas text file as a text, then initializing the TextureAtlas manually and setting the textures for each page.