Support Forum

Is there a way to set a max distance to see a target

I want to code my enemy to only start targeting my player in a certain range

Hi

This will have to be controlled by your game code. Something like this script:

public Transform target;
void Update() {
    if (Vector3.Distance(ai.position, target.position) < 5) {
        ai.destination = target.position;
        ai.isStopped = false;
    } else {
        ai.isStopped = true;
    }
}