using UnityEngine; using UnityEngine.AI; public class MoveAction : MonoBehaviour { public GameObject ControlModel; public Vector3 Destant = Vector3.zero; public float AgentSpeed = 5.0f; public float AgentRadius = 0.3f; public float AgentHeight = 2.0f; public float AgentAngularSpeed = 30000; private void OnEnable() { if (ControlModel == null) ControlModel = gameObject; var Nav = ControlModel.EnsureComponent(); if (Nav != null) { Nav.speed = AgentSpeed; Nav.radius = AgentRadius; Nav.height = AgentHeight; Nav.angularSpeed = AgentAngularSpeed; if (Destant == Vector3.zero) Nav.SetDestination(transform.position); else Nav.SetDestination(Destant); } } }