hello i’ve just started using unity and programming but im having a problem when i use the GameObject variable in a “string” it keeps on giving me this error message: cannot convert ‘UnityEngine.GameObject’ to ‘string’ heres the code i used:
{
public GameObject Enemy;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
private void OnTriggerEnter (Collider collision)
{
if(collision.tag == "Player")
{
GameObject.Find(Enemy).GetComponent<UnityEngine.AI.NavMeshAgent>().enabled=true;
GameObject.Find(Enemy).GetComponent<EnemyController>().enabled=true;
GameObject.Find(Enemy).GetComponent<Animator>().enabled=true;
}
}
}