I am new in unity; please help me with animation thank you

Hello all,
since I’m just starting with programming everything is still new to me,

and I have a question because I want to create an opponent in 2D and use animations I wanted to ask how to do the walking. (to the left; right; forward and back)

what do I have to change in these scrips thanks in advance :smiley:


I’m not sure how you animate the character, but you can extract which direction the agent is moving in using e.g. ai.velocity. For example

var velocity = ai.velocity;
var walkingForward = velocity.y > Mathf.Abs(velocity.x);