• Unity
  • Spawn bone hierarchy in Real Time

Hello,

I am looking for a way to add the Skeleton Utility , then instantiating the whole bone hierarchy in real time.

Haven´t found a way to do so.
I someone can trow a light at this.

Thank you,
Andre

Related Discussions
...

You can add the SkeletonUtility component just as you would add any component in Unity:

var skeletonUtility = component.gameObject.AddComponent<SkeletonUtility>();

To spawn the SkeletonUtilityBone hierarchy, you can then use

skeletonUtility.SpawnHierarchy(SkeletonUtilityBone.Mode mode, bool pos, bool rot, bool sca)

You can have a look at the inspector code here:
spine-runtimes/SkeletonUtilityInspector.cs at 3.8

4 mois plus tard

Thank you.

3 ans plus tard

Any way to despawn the hierarchy or update the skeleton data safely?

    revolt3r Any way to despawn the hierarchy [..]

    If by de-spawn you mean to destroy the spawned hierarchy GameObjects: the SpawnHierarchy method returns a GameObject as the root of the spawned hierarchy. You can Destroy() this GameObject and then set skeletonUtility.boneRoot = null;.

    revolt3r or update the skeleton data safely?

    Could you please describe in more detail what you mean by that, what you would like to achieve?