Unity - Scripting API: Animator.GetParameter
Success!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Submission failed
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Parameters
| Parameter | Description |
|---|---|
| index | The index of the parameter to obtain. |
Returns
AnimatorControllerParameter The parameter at the given index.
Description
Obtains a reference to the AnimatorControllerParameter at the given index.
Throws an IndexOutOfRangeException when the index is not in the range from greater than or equal to 0 to less than Animator.parameterCount.
using UnityEngine; // This example demonstrates how to use the Animator.GetParameter method to get information about the parameters of an Animator controller. [RequireComponent(typeof(Animator))] public class GetParameterExample : MonoBehaviour { Animator m_Animator; void Start() { m_Animator = GetComponent<Animator>(); for (var i = 0; i < m_Animator.parameterCount; i++) { var parameter = m_Animator.GetParameter(i); Debug.Log($"Parameter {i}: {parameter.name} ({parameter.type})"); } } }