Unity2D: My player can not move when animator is on , when animator is off player can move .(code is here)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class playercontroller : MonoBehaviour
{
    private Rigidbody2D rb;
    public float speed;
    Animator anim;
    public float jumpForce;
    private bool aord;
    
    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        anim = GetComponent<Animator>();

    }

   void Update()
   {
    aord = (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.A));
      if(Input.GetKey(KeyCode.D))
       {
       rb.velocity = new Vector2(speed, rb.velocity.y);         
           anim.Play("run");
       }
        if(Input.GetKey(KeyCode.A))
       {
       rb.velocity = new Vector2(-speed, rb.velocity.y);
        anim.Play("run");
       }
       if (aord == false)
       {
        rb.velocity = new Vector2(0, rb.velocity.y);
        anim.Play("Idle");
        
       }

   }
  
   
}

Ответы (0 шт):