I was wondering how i could set up multiple points in a path for my NPC (such as a guard’s patrol route where it goes to one place then another and loops back to the original and repeats), i can make them go to one easy enough, but i have no idea how to make several, can anyone help with this please i am using c# to program and am fairly new, here’s what i got so far.
using UnityEngine;
using System.Collections;
public class EnemyPathScript : MonoBehaviour {
GameObject robo = GameObject.Find ("Search Bot V-1");
public Transform start;
public Transform path1;
public Transform path2;
public Transform path3;
public Transform path4;
public Transform path5;
NavMeshAgent agent;
void Start () {
agent = GetComponent<NavMeshAgent>();
}
void Update () {
if (transform.position = start.position) {
agent.SetDestination (path1.position);
} else if (transform.position = path1.position) {
agent.SetDestination (path2.position);
}
}
}