To export a Spine animation for use in Unity, you need to export the skeleton data and the texture atlas from the Spine editor.
Here is the exact process based on the provided reference:
The Export Process in Spine
After you have finished creating your skeleton and animations in Spine, follow these steps to prepare your assets for import into Unity:
- Open the Export Dialog: Click on the Spine Menu and select Export....
- Choose JSON Format: In the upper-left corner of the Export window, select JSON as the export format. JSON is the standard text-based format for Spine skeleton data and animations.
- Enable Texture Atlas: Check the Texture Atlas Pack checkbox. This is crucial for Unity, as it packs all the individual images (attachments) used by your skeleton into one or more larger texture files and generates a
.atlas
file that maps regions in the textures to the original images. - Specify Output Folder: In the Export window, pick an output folder on your computer where the exported files will be saved.
- Click Export: Finally, click the Export button.
Spine will then generate the necessary files in your chosen output folder.
Understanding the Exported Files
When you export using the JSON format and enable the Texture Atlas Pack, Spine typically generates the following files:
.json
file: This file contains the skeleton structure, bone data, animation timelines, setup pose, and other non-image-related information..atlas
file: This text file describes how the individual images are packed into the texture atlas(es), providing coordinates and dimensions for each image within the packed texture(s)..png
(or other image format) file(s): These are the texture atlas images containing all the packed images from your skeleton.
These three file types (.json
, .atlas
, and the .png
texture atlas image) are the minimum required assets to import your Spine animation into a Unity project using the Spine Unity runtime.
Next Steps in Unity
Once you have these files, you will need the Spine Unity runtime package installed in your Unity project. You can then drag and drop the .json
file (or the entire folder containing all three files) directly into your Unity project window. The Spine Unity runtime will automatically recognize the files and create a Spine GameObject ready for use in your scenes.