UEA0005: DoNotUseFindMethodsInUpdate

October 2, 2019 ยท View on GitHub

PropertyValue
IdUEA0005
CategoryPerformance
SeverityWarning

Example

Code with Diagnostic

using UnityEngine;

public class Example : MonoBehaviour
{
    void Update()
    {
        // UEA0005: Warning to cache the result of find in Start or Awake
        GameObject.Find("");
    }
}

Code with Fix

using UnityEngine;

public class Example : MonoBehaviour
{
    GameObject cachedObj;

    void Start()
    {
        cachedObj = GameObject.Find("");
    }
}