Ссылка на хорошую статью.
https://habr.com/post/414453/
Заставить объект двигаться к определённой цели.
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class MoveGoalScript : MonoBehaviour { void Start () { Vector3 pos = GameObject.Find("goalObj").transform.position; NavMeshAgent scr = gameObject.GetComponent<NavMeshAgent>(); scr.destination = pos; } }
Last updated 4 years ago
Was this helpful?