Float speed not getting updated on FixedUpdate nor Updated and OnAnimatorMove

This is the code.
Simple enough, If I manually touch runtime the Speed Float on the inspector, the Animator Float gets updated, but the rigidbody just doesn’t get the velocity, so in runtime the float remains at 0.

Thanks for any tip :wink:

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

public class AALAnimatorLink : MonoBehaviour

    private Animator animator;
    public float Speed;
    public bool moving;
    public GameObject rigidChild;

    // Use this for initialization
    void Start()

        //    speed == 0.0;
        animator = gameObject.GetComponent<Animator>();


    // Update is called once per frame
   // void FixedUpdate()
        void Update()

       // Speed == rigidbody.velocity.magnitude;

       var Speed = rigidChild.GetComponent<Rigidbody>().velocity.magnitude;

    void OnAnimatorMove()

     //   if (moving)
       // {
            //animator.SetFloat("Speed", speed);
            animator.SetFloat("Speed", Speed);
      //  }


You have redeclared the variable Speed in your Update(). Thus it is local to Update() and the global Speed variable has no effect on this variable.

Also, you need to assign the velocity of rigid body as a Vector if you want to change its velocity.