UEA0010: DoNotUseStateNameInAnimator

October 2, 2019 ยท View on GitHub

PropertyValue
IdUEA0010
CategoryPerformance
SeverityWarning

Example

Code with Diagnostic

using UnityEngine;

class Example : MonoBehaviour
{
    Animator animator;

    void Update()
    {
        animator.SetInteger("Walk", 1);
    }
}

Code with Fix

using UnityEngine;

class Example : MonoBehaviour
{
    Animator animator;
    int walkHash;

    void Start()
    {
        var walkHash = Animator.StringToHash("Walk");
    }

    void Update()
    {
        animator.SetInteger(walkHash, 1);
    }
}