UEA0005: DoNotUseFindMethodsInUpdate
October 2, 2019 ยท View on GitHub
| Property | Value |
|---|---|
| Id | UEA0005 |
| Category | Performance |
| Severity | Warning |
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("");
}
}