2D Toolkit Forum

2D Toolkit => Support => Topic started by: dudeofNFL on December 01, 2015, 04:26:40 am

Title: how do I access a different animation?
Post by: dudeofNFL 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

Title: Re: how do I access a different animation?
Post by: unikronsoftware 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.