At the moment I have some placeholder gameobjects (which contain important physics components etc), they are stored as prefabs.

As I complete my animations, I want to get my existing prefab and I want to attach spine animations onto that prefab. I can't really figure out a nice way to do this- the only way I can seem to do it is to drag the spine SkeletonData into the scene window to instantiate a new "SkeletonAnimation" gameobject, then I have two options:

1) copy each component from the prefab onto the new object (takes time as I cant seem to select/copy/paste multiple components at the same time), then delete the old prefab and replace it with this new one

or 2) copy each component from the new spine gameobject onto the existing prefab (takes time as I cant seem to select/copy/paste multiple components at the same time)

I do realise I could just child the new gameobject onto the prefab, but my code isn't set up to work that way and would take some re-factoring, I just wondered if I'm missing a way to do this or if it was a reasonableish request to add to Spine in future?
Posts: 9


I guess you already know the "Instantiate from Script" example scene where you can find various ways to instantiate Spine objects (as SkeletonAnimation or SkeletonGraphic objects). You can use these example scripts as a reference and replace the call to NewSkeletonAnimationGameObject() by AddToGameObject().
Replace this line:
spine-runtimes/SpawnFromSkeletonDataExample.cs at 3.7
with this one:
SkeletonAnimation.AddToGameObject(targetGameObject, runtimeSkeletonDataAsset);
User avatar

Posts: 56

Return to Unity