- 수정됨
Text/numbers on a Spine animation through Unity
We are making a game, but theres the animated robot which has some text on its display.
He will eventually move and we were hoping theres a way to have a placeholder/container to put the text in so its parented to the animation
1 how do I set up a skeleton to have a text object which available to Unity
2 how does the developer script the text object, to be interactive text through script, but parented to the animation?
How to do this relies on your setup for Text - is your text component going to be on the UI layer (in a canvas)? Or do you have a way of displaying the text as a non-UI gameobject?
The BoneFollower component (spine-unity Runtime Documentation: BoneFollower) is a quick and easy way to have one gameobject follow a bone on a Spine animation.
There is also a BoneFollowerGraphic component, which works with spine animations that are using the SkeletonGraphic setup (basically using a Spine animation as a UI element, on a canvas).
You can also use this:
skeletonAnimation.skeleton.FindBone("bonename").GetWorldPosition(spineGameObjectTransform);
If your spine character is on a regular layer, but your Text is in a Screen-Space Canvas, you may have to do some special coordinates systems converting to get the correct position. An easier way to do it would be to have a separate Canvas just for the Text that is set up as a World Space canvas, and you put that entire Canvas into a GameObject and position that GameObject. But having a ton of Canvases isn't a good idea, so I would only do it if you have a few of these robot guys.
Thanks again Jamez0r for helping! You rock! 8)
Jamez0r wroteHow to do this relies on your setup for Text - is your text component going to be on the UI layer (in a canvas)? Or do you have a way of displaying the text as a non-UI gameobject?
The BoneFollower component (spine-unity Runtime Documentation: BoneFollower) is a quick and easy way to have one gameobject follow a bone on a Spine animation.
Thank you for answering, we found the bone follower component. Im having our dev look into it now!
I actually dont know if its a UI element. We have to discuss that a bit :nerd: