boboshu

the game is <priconne redive > use spine for multiple skeleton by cygame.
it make by unity and spine.
the game hero animation load common_animation(idle,run,...) (000000_CHARA_BASE.cysp) ,and AdditionAnimation (180401_DEAR.cysp),and load SkillAnimation(*****_COMMON_BATTLE.cysp)..then merge the 3 Binary File,and load ...

how to do this? our project also want use the solutions,please for help for unity.


here the code is someone write js version for webdemo with <redive > game spine resource
//assume always no more than 128 animations
var newBuffSize = generalBattleSkeletonData[baseId].byteLength - 64 + 1 +
currentClassAnimData.data.data.byteLength +
currentCharaAnimData.data.data.byteLength;
additionAnimations.forEach(function (i) {
newBuffSize += i.data.byteLength;
})
var newBuff = new Uint8Array(newBuffSize);
var offset = 0;
newBuff.set(new Uint8Array(generalBattleSkeletonData[baseId].slice(64)), 0);
offset += generalBattleSkeletonData[baseId].byteLength - 64;
newBuff[offset] = animationCount;
offset++;
newBuff.set(new Uint8Array(currentClassAnimData.data.data), offset);
offset += currentClassAnimData.data.data.byteLength;
newBuff.set(new Uint8Array(currentCharaAnimData.data.data), offset);
offset += currentCharaAnimData.data.data.byteLength;
additionAnimations.forEach(function (i) {
newBuff.set(new Uint8Array(i.data), offset);
offset += i.data.byteLength;
})

var skeletonBinary = new spine.SkeletonBinary(atlasLoader);
var skeletonData = skeletonBinary.readSkeletonData(newBuff.buffer);
var skeleton = new spine.Skeleton(skeletonData);
skeleton.setSkinByName('default');
var bounds = calculateBounds(skeleton);
boboshu
  • Posts: 7

Harald

The code above concatenates parts of the three skeleton binary files using the respective byte offsets.
If you do not know what the above code does, how to read the SkeletonBinary file reader code or how to concatenate files at certain byte offsets, then we would not recommend to take this path, as you need to adapt the byte offsets to the respective spine-unity version (as the binary format might have changed).

What would be easier to manage would be to load the skeletons and then append the already loaded data (e.g. only animations) to your main skeleton. Note that you may need to adjust indices and references when something is only part in one of the skeletons (e.g. if you have added attachments at one skeleton only).

You can have a look at this forum thread here which explains some necessary steps:
请问Spine用脚本载入时怎么才能不载入图集只取动画
User avatar
Harald

Harri
  • Posts: 2075


Return to Unity