PROBLEM WITH ANIM.SETBOOL NOT WORKING
Hi,when I try to change the value of a boolean to true i see with some check that this instruction don't work, so the boolean remain false and the animation don't start....I have no idea of what i could do because i checked many thing and i try many solutions but nothing worked
this is the code:
 public class PlayerMovement : MonoBehaviour {
 
 
  [SerializeField]
  public float speed = 5f;
  Rigidbody2D body;
  Animator anim;
  // Use this for initialization
  void Start () {
      body = GetComponent<Rigidbody2D>();
      anim = GetComponent<Animator>();
  }
  
  // Update is called once per frame
  void Update () {
      Movement();
  }
  void Movement()
  {
      float h = Input.GetAxisRaw("Horizontal");
      float v = Input.GetAxisRaw("Vertical");
      Vector2 mov = new Vector2(h,v);
      body.MovePosition(body.position + mov.normalized * Time.deltaTime * speed);
      if (v != 0 || h!=0)
      {
          anim.SetBool("IsMovingForward", true);
          anim.SetBool("IsMoving", true);
      }
      else
      {
          anim.SetBool("IsMovingForward", false);
          anim.SetBool("IsMoving", false);
      }
  }
 
              
               Comment
              
 
               
              Ins$$anonymous$$d of setting the value for anim on Start can you try to assign the animator on the prefab/GameObject in the editor itself and see if the issue still persists.
Your answer
 
             Follow this Question
Related Questions
Animator Boolean not changing to true in C#, 0 Answers
Animator boolean problem 2 Answers
Changing eye texture using bools 0 Answers
Animation problem? 0 Answers