Kyrill91

  • 10 févr. 2014
  • Inscrit 10 févr. 2014
  • I just started using Spine today and was curious as to if there are any tutorials on how to script animations in unity?

    I currently have two animations for one character: run and jump. I was able to import into unity and get the running animation to work. Now I am trying to script the jump animation to the space key and I'm having the hardest time trying to get it to work. Here's what I have:

    private SkeletonAnimation skeletonAnimation;
    
    void Start () {
    	skeletonAnimation = GetComponent<SkeletonAnimation> ();
    }
    
    void Update () {
    	if (Input.GetKey ("space")) {
    		skeletonAnimation.state.SetAnimation("jump");
    	}
    }