Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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

index

The index of the parameter to obtain.

Returns

Type

Description

AnimatorControllerParameterThe parameter at the given index.

Remarks

Throws an
IndexOutOfRangeException
when the index is not in the range from greater than or equal to 0 to less than _parameterCount.
Additional Resources: AnimationParameters, _parameters

Examples

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})"); } }}