Animation in new Input System

Hi, guys!
I have Input System with Action Moving and inside it have Vector2D Composite, with up - W; down - S; left - A;
right - D.
How to do when i for example press D animation would be for right and so on?
Using comparing, for instance, if (_movingDirection == Vector2.right) { _animator.Play(_animationName)}
isn’t so good, i think. Maybe there are some more methods how to do it?

Don’t conflate systems.

New input system (or old input system) has absolutely nothing to do with animations.

An input system reads inputs and gives values back.

That’s it.

You should store those values to temporary variables.

Then your code should act on those stored temporary values each frame.

Some of your actions might include:

  • moving the player
  • animating the player
  • playing sounds
  • firing weapons.
    etc

Note how NONE of the ultimate uses of the input data have anything to do with where the input came from.

1 Like

Ok, thanks!