Unity GameObject has a property gameObject that returns this. This allows calls like GameObject.gameObject.gameObject to occur which is redundant and hinders performance.
using UnityEngine;
class Camera : MonoBehaviour
{
private void OnTriggerEnter(Collider collider)
{
GameObject original = null;
GameObject duplicate = original.gameObject;
}
}Fix expression:
using UnityEngine;
class Camera : MonoBehaviour
{
private void OnTriggerEnter(Collider collider)
{
GameObject original = null;
GameObject duplicate = original;
}
}A code fix is offered for this diagnostic to automatically apply this change.