【发布时间】:2017-09-13 21:31:35
【问题描述】:
所以在更新 Unity 之前这工作正常,但在我更新后我不断收到这两个错误
UnityEngine.AI.NavMeshAgent.Resume()' 已过时:`将 isStopped 设置为 false'
UnityEngine.AI.NavMeshAgent.Stop()' 已过时:`将 isStopped 设置为 true'
这是我的代码
public class Navigation : Interaction
{
public float RelaxDistance = 5;
private NavMeshAgent agent;
private Vector3 target = Vector3.zero;
private bool selected = false;
private bool isActive = false;
public override void DeSelect()
{
selected = false;
}
public override void Select()
{
selected = true;
}
public void SendToTarget()
{
agent.SetDestination(target);
agent.Resume();
isActive = true;
}
void Start()
{
agent = GetComponent<NavMeshAgent>();
}
// Update is called once per frame
void Update()
{
if (selected && Input.GetMouseButtonDown(1))
{
var tempTarget = RtsManager.Current.ScreenPointToMapPosition(Input.mousePosition);
if (tempTarget.HasValue)
{
target = tempTarget.Value;
SendToTarget();
}
}
if (isActive && Vector3.Distance(target, transform.position) < RelaxDistance)
{
agent.Stop();
isActive = false;
}
}}
我的预制件有一个 NavMeshAgent 我重新烘焙了地形。我只需要指向正确的方向或提示
【问题讨论】:
标签: c# unity3d navigation