2017-09-13 54 views
0

所以这个工作得很好更新团结过,但我更新后,我不断收到这两条错误统一导航NavMeshAgent

UnityEngine.AI.NavMeshAgent.Resume()“已过时:`设置isStopped为false,而不是”

UnityEngine.AI.NavMeshAgent.Stop() '已过时:`设置isStopped为真,而不是'

这是我的代码

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而我雷巴克编辑地形..我只需要指向正确的方向或提示

回答

0

只要做错误说和改变agent.Resume()到agent.isStopped = false和agent.Stop()代理。 isStopped = true。

+0

我已经这样做了,它不工作.... –

+0

你的意思是不行?你仍然收到错误? –

+0

好吧,我工作得很好,一些他妈的理由,我需要重新启动团结 –