Skeletal Animation Assets (Spine)

Skeletal animation assets in Creator are exported from Spine, which currently supports the JSON and binary data formats.

The supported Spine versions for each Creator version are as follows.

Creator VersionSpine Version
v2.0.7 and belowv2.5
v2.0.8 to v2.1v3.6v2.2v3.7
v2.2v3.7
v2.3 and abovev3.8

Import Skeletal Animation Assets

The assets required for skeletal animation are:

  • .json/.skel skeletal data
  • .png atlas textures
  • .txt/.atlas atlas data

    spine

Create Skeletal Animation

Drag the skeletal animation asset from the Assets panel to the SkeletonData property of the spine component in the Inspector panel.

spine

How to load Spine remotely from a server

Load the Spine assets in json format

  1. let comp = this.getComponent('sp.Skeleton') as sp.Skeleton;
  2. let image = "http://localhost/download/spineres/1/1.png";
  3. let ske = "http://localhost/download/spineres/1/1.json";
  4. let atlas = "http://localhost/download/spineres/1/1.atlas";
  5. assetManager.loadAny([{ url: atlas, ext: '.txt' }, { url: ske, ext: '.txt' }], (error, assets) => {
  6. assetManager.loadRemote(image, (error, texture: Texture2D) => {
  7. let asset = new sp.SkeletonData();
  8. asset.skeletonJson = assets[1];
  9. asset.atlasText = assets[0];
  10. asset.textures = [texture];
  11. asset.textureNames = ['1.png'];
  12. skeleton.skeletonData = asset;
  13. });
  14. });

Load the Spine assets in binary format

  1. let comp = this.getComponent('sp.Skeleton') as sp.Skeleton;
  2. let image = "http://localhost/download/spineres/1/1.png";
  3. let ske = "http://localhost/download/spineres/1/1.skel";
  4. let atlas = "http://localhost/download/spineres/1/1.atlas";
  5. assetManager.loadAny([{ url: atlas, ext: '.txt' }, { url: ske, ext: '.bin' }], (error, assets) => {
  6. assetManager.loadRemote(image, (error, texture: Texture2D) => {
  7. let asset = new sp.SkeletonData();
  8. asset._nativeAsset = assets[1];
  9. asset.atlasText = assets[0];
  10. asset.textures = [texture];
  11. asset.textureNames = ['1.png'];
  12. asset._uuid = ske; // Any string can be passed in, but it cannot be empty.
  13. asset._nativeURL = ske; // Pass in a binary path to be used as the 'filePath' parameter when using 'initSkeleton'.
  14. comp.skeletonData = asset;
  15. let ani = comp.setAnimation(0, 'walk', true);
  16. });
  17. });