Thanks Mitch! Great that it's possible.
The way I currently Instantiate SpineAnimations, is by Right-clicking the name_SkeletonData and then "Instantiate (SkeletonAnimation)". Can you give me a hint how to implement the technique you said above? The Inspector shows me a "Skeleton Mesh", how do I apply one of those to another Spine GameObject?
Or do I have to manually instantiate and animate the Spine Animations?
Thanks for your time.
edit
(Disclaimer: I'm a self-taught programmer and no formal coding education.)
So, I found a solution for using "pooled" skeletons for the creeps. Unfortunately, the performance-gain is negligible (probably doing it wrong?). The way I'm doing it:
I have 5 Spine Animations spawned in the scene with disabled MeshRenderers. Those Objects are animated manually ( in their respective Update() ):
animation.Apply(skeletonRenderer.skeleton, 0, animationTime, false, null);
skeletonRenderer.skeleton.UpdateWorldTransform();
Then I instantiate 200 other Spine Animations and set in their Awake():
skeletonAnimation = GetComponent < SkeletonAnimation> ();
skeletonAnimation.skeleton = targetSkeletonAnimation.skeleton;
This way, all the 200 creeps animate exactly as the 5 pooled animations. But like afore mentioned, the performance is still pretty bad.
For comparison, I made a Spine Animation with just the Root-Bone and one Slot/Attachement, and used this Spine Animation for the test. And unfortunately, the Performance is still not acceptable for our cause. I use the Nexus 4 as a mobile test Device, but on my MacBook Air i5 the performance is also not amazing.
Data, Device used Nexus 4:
(The Testscene has a Spline, which the Animations follow)
Test with native textured Quads as reference:
10 Quads -> 60fps
50 Quads -> 60fps
100 Quds -> 60fps
200 Quads -> 60fps
500 Quads -> 50fps
Test with SRT only Animation, approx. 20 Bones:
10 SRT -> 60fps
50 SRT -> 55fps
100 SRT -> 30fps
200 SRT -> 20fps
500 SRT -> 8fps
Test with the same SRT Animation, but with 5 pooled Skeletons:
10 Creeps -> 60fps
50 Creeps -> 60fps
100 Creeps -> 42fps
200 Creeps -> 23fps
500 Creeps -> 11fps
Now as a test, an Animation with just the Root-Bone and one Slot/Attachement:
10 Anims -> 60fps
50 Anims -> 48fps
100 Anims -> 30fps
200 Anims -> 20fps
500 Anims -> 10fps
I only use one Animation and Unity batches everything nicely. I wonder how it is possible, that an "empty" animation with just one bone/slot/attachement can be this slow. Is it because the MeshRenderer is this slow? The profiler states that the LateUpdate(), probably in the SkeletonRenderer, is very heavy.
I wonder if other Runtimes, e.g. the Libgdx are much faster. Is it possible, that the Unity-Spriter-Runtime is simply not usable/optimized for a Tower Defense Game with lots of Creeps?
What are your thoughts about this? Did I do something wrong in the way I import/use the Animations? What is the bottleneck in Unity?
Thanks a lot for your time and thought.