GetParameter(int)
Obtains a reference to the AnimatorControllerParameter at the given index.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.AnimationModule
public AnimatorControllerParameter GetParameter(int index)
Parameters
The index of the parameter to obtain.
Returns
Type | Description |
|---|---|
| AnimatorControllerParameter | The parameter at the given index. |
Remarks
Throws an when the index is not in the range from greater than or equal to 0 to less than Animator.parameterCount.
IndexOutOfRangeExceptionusing 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})"); } }}
Additional Resources: AnimationParameters manual. AnimatorController.parameters for accessing the list of parameters.