using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class seePlayer : MonoBehaviour
{
public bool alive = true;
private void OnTriggerEnter(Collider other)
{
Debug.Log("something seen");
if (other.gameObject.name == "eyes")
{
other.transform.parent.GetComponent<EnemyAI>().checkSight();
}
}
}
So let me give you a breakthrough of what I intended to do, if player goes into a cylinder collider field, it would activate the ontriggerenter event, thus executing the code that will be ran in another script to make an enemy follow the player until it loses line of sight. I tried working with the other script everything runs there, and found that it was detecting the player was the main problem. I set the collider of the cylinder to convex → trigger in the inspector. Let me know if you need more info to solve my issue.