Is there a way to where I can make a script with an array of Transforms that will have the rigidbody move towards them in order?
EG:
Point A → Point B → Point C → Point A …
Is there a way to where I can make a script with an array of Transforms that will have the rigidbody move towards them in order?
EG:
Point A → Point B → Point C → Point A …
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class Test : MonoBehaviour
{
public Transform Destinations;
public NavMeshAgent agent;
void FixedUpdate()
{
for (int i = 0; i < Destinations.Length;)
{
agent.SetDestination(Destinations*.position);*
if(agent.transform.position.x == Destinations*.position.x)i++;*
}
}
use NavMeshAgent Instead