Input.GetAxis() not returning -1, 0, or 1

When I hit play in Unity, var hor value is 0, as it should be, then 1 when I press and hold Horizontal’s positive key, as it should. Then -1, as I press and hold Horizontal’s negative key, as it should.

But hor is not changing, it is 0 all the time.

screenshot of a text editor|690x442

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

public class SimpleMovement : MonoBehaviour
{
    public float speed = 5.0f;
    private Rigidbody2D rigidBody2D;

    void Start()
    {
        rigidBody2D = GetComponent<Rigidbody2D>();
    }

    void Update()
    {
        var hor = Input.GetAxis("Horizontal") * Time.deltaTime;
        rigidBody2D.velocity = new Vector2(hor * speed, rigidBody2D.velocity.y);
        Debug.Log(hor);

    }
}

i was using the unity version 2022.3.4f1 LTS that shows the input error for me, but since i have used old version 2021.3.29f1 LTS, so its working fine

var horInput= Input.GetAxis("Horizontal");
var currentHorInput = Mathf.SmoothStep(currentHorInput , horInput, Time.deltaTime * smootInput);

 rigidBody2D.velocity = new Vector2(currentHorInput * speed, rigidBody2D.velocity.y);  //(thats your code)

so “smoothInput” is the time(float) that need to go from the current input to target input (set it as 15 at first, it will work great, when the value is bigger its gonna be faster so less smooth)