Comparing tags using == is slower than using the built-in CompareTag method.
using UnityEngine;
public class Camera : MonoBehaviour
{
private void Update()
{
Debug.Log(tag == ""tag1"");
}
}
Use CompareTag method:
using UnityEngine;
public class Camera : MonoBehaviour
{
private void Update()
{
Debug.Log(CompareTag(""tag1""));
}
}
A code fix is offered for this diagnostic to automatically apply this change.