Using ex2d animation

Hi All,

I’m trying ex2d for my 2d game with Unity via exSpriteAnimation class.

I’ve written this little code inside Update method:

if (Input.GetButton(“Horizontal”))
{
exSpriteAnimation exAnim = GetComponent();
exAnim.Play(“ex2dAnim”);
}

The thing is when I press the D key notthing happens only when I realse it the animation starts. Have u came across with this kind of behaviour?

Do u know the solution?

Thank u in advance

1 Answer

1

It might be it’s not registering whether to play the animation when the button is pressed down or when it is released. Try one of these and it might fix that

if(Input.GetButtonDown(“Horizontal”))

if(Input.GetKeyDown(“Horizontal”))