Hi! I'm a begginer coding with Spine, I just never used the internal functions of it to code my animations (always used Mecanim + Skeleton Animator).
So here's my question (in c#): How do I code in SkeletonGraphic to switch between different animations?
Example:
private SkeletonGraphic skeletonGraphic;
[SpineAnimation]
public string customAnimation;
public void SetAnimation(string animation)
{
animation = customAnimation;
// HERE I WILL CODE THAT THE "CURRENT SKELETONG GRAPHIC ANIMATION" CHANGES TO MY "CUSTOM ANIMATION"
}
This Script will be attached to the SkeletonGraphic object, that's why I add a reference to this component.
Thanks for the support! π
SOLVED:
OKAY! I didnt take a look at the API.... ye, I was so lazy....
In case this could be useful for anyone, there's the quick code solution:
private SkeletonGraphic skeletonGraphic;
[SpineAnimation]
public string normalAnim;
void Start()
{
skeletonGraphic = GetComponent<SkeletonGraphic>();
}
public void SetNormal()
{
skeletonGraphic.AnimationState.SetAnimation(0, normalAnim, true);
}
:sun: :sun: :sun: :sun: :sun: