Animator anim = GetComponent(); float speedValue = anim.GetFloat("Speed");
GameObject enemy = GameObject.Find("Enemy"); Animator anim = enemy.GetComponentBrief Description: These code examples demonstrate the use of UnityEngine Animator GetFloat method to retrieve float values of parameters from Animator components. The first example retrieves the "Speed" value from the Animator component attached to the current game object, while the second example retrieves the "Health" value from the Animator component attached to a specific game object called "enemy". Package Library: The UnityEngine Animator GetFloat method is part of the Unity engine's Animation package.(); float healthValue = anim.GetFloat("Health");