I have an enemy AI script I got online and it works great except that the bad guy will shoot at me through walls. I searched and found a lot of the same question but no answers. I think what is the problem is this line of code that looks like it just seeks me out by distance. I think it should be a raycast of some kind?
I’ll keep plugging away at it but any help would be greatly appreciated . Here is probably the detection code I need to alter. If you need more info I can paste the whole script but I think this is the culprit
if(Vector3.Distance(transform.position,Player.position) <= MaxDist)
{
PlayerDetected = true;
if (PlayerDetected)
{