Is there any AI script, that doesn't go through walls?

I just need a simple AI that follows the player if the player is in a specific distance. But all AIs go through the walls! I tried to apply physics (colliders), but that didn’t work! Please help! :frowning:

You should try Making a navmesh and then adding a Nav Mesh Agent to your AI character.
You can then change it’s destination through code.

Here’s an example script(Add to a C# script called “AIFollow” without quotations.):

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(NavMeshAgent))]

public class AIFollow : MonoBehaviour {

    public GameObject targetObject;     //This is the object that the AI will follow.

    public float followDistance = 5;    //This is the distance that the AI will start following.

    private NavMeshAgent agent;         //The nav mesh agent component.

    void Start()
    {
        agent = GetComponent<NavMeshAgent>() as NavMeshAgent;   //Setting the nav mesh agent.
    }

	// Update is called once per frame
	void Update () {
        float distance = Vector3.Distance(transform.position, targetObject.transform.position);     //Getting the distance between the AI and the player.
        if (distance <= followDistance)
        {
            agent.SetDestination(targetObject.transform.position);
        }
        else
        {
            agent.SetDestination(transform.position);
        }
	}
}

12th. Unity Tutorial, Enemy AI - Create a Survival Game - YouTube His works well and is a short script