| mode | Update frequency mode. |
| frequency | Update frequency value. |
Set the update frequency of the Animator.
This method allows you to set the update frequency of the Animator, the value of the parameter frequency determined by the AnimatorUpdateFrequencyMode. frequency value that do not meet expectations are automatically adjusted, and the Animator is updated no more frequently than PerFrame.
In the example script below, reducing the frequency of animation updates for a performance boost.
using UnityEngine;
public class Example : MonoBehaviour { Animator m_Animator;
void Start() { //Get the Animator attached to the GameObject you are intending to animate. m_Animator = gameObject.GetComponent<Animator>(); }
void Update() { //The animation is updated every 4 frames m_Animator.SetUpdateFrequencyMode(AnimatorUpdateFrequencyMode.FixedFrame, 4); //The animation is updated every 0.1 seconds m_Animator.SetUpdateFrequencyMode(AnimatorUpdateFrequencyMode.FixedTime, 0.1f); //Revert to update per frame m_Animator.SetUpdateFrequencyMode(AnimatorUpdateFrequencyMode.PerFrame); } }