Files
2026-01-13 15:43:33 +00:00

26 lines
600 B
C#

using StarterAssets;
using UnityEngine;
using UnityEngine.AI;
public class Drone : MonoBehaviour
{
FirstPersonController player;
NavMeshAgent agent;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Awake()
{
agent = GetComponent<NavMeshAgent>();
}
void Start()
{
player = FindFirstObjectByType<FirstPersonController>();
}
// Update is called once per frame
void Update()
{
agent.SetDestination(player.transform.position);
transform.LookAt(player.transform);
}
}