Created
March 9, 2024 20:58
-
-
Save unitycoder/8e6e27faca3d40abf50c0842a51af558 to your computer and use it in GitHub Desktop.
NavMesh Agent sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.AI; | |
public class TestAgent : MonoBehaviour | |
{ | |
public Transform target; | |
NavMeshAgent agent; | |
void Start() | |
{ | |
agent = GetComponent<NavMeshAgent>(); | |
agent.SetDestination(target.position); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment