Answer the question
In order to leave comments, you need to log in
After animating a sprite in a unit, the animation stopped mirroring, how to solve?
I'm making a simple platformer on Unity, and I ran into such a problem. The character stopped mirroring after it was animated (for example, if the character goes forward, then everything is fine, but if it goes back, it still looks forward
. Here is the code that is responsible for running, and for something that the animation would be mirrored
private void Run()
{
Vector3 direction = transform.right * Input.GetAxis("Horizontal");
transform.position = Vector3.MoveTowards(transform.position, transform.position + direction, speed * Time.deltaTime);
sprite.flipX = direction.x < 0.0F;
if (isGrounded)State = CharState.Run;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question