Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 675 Bytes

File metadata and controls

43 lines (33 loc) · 675 Bytes

UEA0004: UseCompareTag

Property Value
Id UEA0004
Category GC
Severity Warning

Example

Code with Diagnostic

using UnityEngine;

public class Example : MonoBehaviour
{
    void OnTriggerEnter(Collider other)
    {
        // UEA0004: Using CompareTag for tag comparison does not cause allocations
        if (other.tag == "Player")
        {

        }
    }
}

Code with Fix

public class Example : MonoBehaviour
{
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {

        }
    }
}