2D Animation, Unsure what I am doing wrong

Still figuring things out, been researching for a while on why an animation is not starting. Below is the code that is being used

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

public class PlayerTestScript : MonoBehaviour
{
    public float moveSpeed;
    public float horizontalMovement;
    private Rigidbody2D rigidBody2d;
    private Animator anim;

    // Start is called before the first frame update
    void Start()
    {
        rigidBody2d = GetComponent<Rigidbody2D>();
        anim = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        horizontalMovement = Input.GetAxisRaw("Horizontal");
        rigidBody2d.velocity = new Vector2(horizontalMovement * moveSpeed, rigidBody2d.velocity.y);
        //Walk Animation
        if (horizontalMovement == 0)
        {
            anim.SetBool("isWalking", false);
            if (anim.GetBool("isWalking"))
            {
                Debug.Log("isIdle");
            }
        }
        else
        {
            anim.SetBool("isWalking", true);
            if (anim.GetBool("isWalking"))
            {
                Debug.Log("isWalking");
            }
        }
    }
}

I am able to see with the log that the bool is getting set to true, as well as in the animator (GIF)

8631777--1160442--Unity_7pvFpfIjDZ.gif

Any thoughts or advice would be appreciated.

The code is working. Im not seeing the transition from idle to walk lighting up though. the transition from walk to idle however does. Did you just forget to add the parameter to the transition possibly?

So I just found out the issue about an hour ago. The issue came about because of where the animator component was in the hierarchy.

the animator itself was on the sprite while the component was on the main object (if that makes sense)