$begingroup$

I would like my enemy to maneuver randomly to sure factors on the scene. It strikes to at least one level after which stops! It doesn’t proceed to the opposite factors!

Here is my script:

utilizing UnityEngine;
utilizing System.Collections;

public class emove: MonoBehaviour {

NavMeshAgent ePath;
public GameObject[] POINT;

void Start () {
    ePath = GetComponent<NavMeshAgent>();
}

void Update () {

    foreach (GameObject waypoint in POINT) {
        ePath.SetDestination(waypoint.remodel.place);
        ePath.pace = 2;

      // I write this, if in case you have totally different thought inform me please
        if (waypoint.activeSelf == false) // waypoint had it personal script, when enemy contact any level it set off
        {
            ePath.SetDestination(waypoint.remodel.place); // transfer to every other energetic waypoint.
            ePath.pace = 2;
        }
    }
}

What am I doing flawed?

$endgroup$

1