GetComponent
, TryGetComponent
, GetComponents
, GetComponentInChildren
, GetComponentsInChildren
, GetComponentInParent
, and GetComponentsInParent
should be called only with Types that extend UnityEngine.Component
, or Types that are an Interface
using System.Collections;
using UnityEngine;
class Camera : MonoBehaviour
{
private int i;
private void Start()
{
i = GetComponent<int>();
}
}
Make sure the type argument passed to any GetComponent
method extends UnityEngine.Component
, or is an Interface Type.
No automatic code fix is available for this diagnostic.