Hello Guest

Author Topic: how do I access a different animation?  (Read 3567 times)

dudeofNFL

  • Newbie
  • *
  • Posts: 1
    • View Profile
how do I access a different animation?
« on: December 01, 2015, 04:26:40 am »
from unity 3d
tk2dSpriteAnimator anim;

   void Start () {
      animator = GetComponent<tk2dSpriteAnimator>();
   }

public void Jump(){
if(groundIsFalse){
anim.Play("jump");
}
}

currently I can access all there animation in this spriteAnimaiotn but how do i access a different spriteCollectionAnimation.
what i did is I added a new clip of animation and change the collection to different and I can access the animation clip but when the animation play, the sprite is too big. I  guess  the question is how can play a different animation in a different animation clip? I cannot just put all the sprite in one spriteCollection since it too big. any help is appreciated


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: how do I access a different animation?
« Reply #1 on: December 06, 2015, 12:20:01 pm »
[SerializeField] tk2dSpriteAnimation newAnimation;

animator.Library = newAnimation;
animator.Play("NewClipName");

You can also load it in using Resources.Load.