Страница 1 из 1
NightKot
Hello. Help with advice. I created a character with two Skins, each with two animations. Idle and Walk. In the first the character has an active Idle, in the second Walk. How to switch skins and animations from the code correctly?
2 months ago
- NightKot
- Сообщения: 8
Harald
Please check out the documentation pages here, they explain everything you might need:
spine-unity Runtime Documentation: spine unity Runtime Documentation
spine-unity Runtime Documentation: spine unity Runtime Documentation
2 months ago
-
Harald - Сообщения: 2778
NightKot
Thank. I will read it.
---
Thank. The problem has been resolved.
using Spine.Unity;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AnimState : StateMachineBehaviour
{
public string animationName;
public string skinName;
public float speed;
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int LayerIndex)
{
SkeletonAnimation anim = animator.GetComponent<SkeletonAnimation>();
anim.initialSkinName = skinName;
anim.Initialize(true);
anim.state.SetAnimation(0, animationName, true).TimeScale = speed;
}
}
---
Thank. The problem has been resolved.
using Spine.Unity;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AnimState : StateMachineBehaviour
{
public string animationName;
public string skinName;
public float speed;
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int LayerIndex)
{
SkeletonAnimation anim = animator.GetComponent<SkeletonAnimation>();
anim.initialSkinName = skinName;
anim.Initialize(true);
anim.state.SetAnimation(0, animationName, true).TimeScale = speed;
}
}
2 months ago
- NightKot
- Сообщения: 8
Harald
Glad you've figured it out, thanks for letting us know.
1 month ago
-
Harald - Сообщения: 2778
Mark topic unread
• Страница 1 из 1
Вернуться в Unity
- Часовой пояс: UTC