// Update is called once per frame void Update() { if (unit.GetCanMove()) { //set the speed on the nav mesh agent to that of the unit navmeshAgent.speed = (unit.GetMovespeed() + unit.GetAddedMovespeed()) / 10; navmeshAgent.acceleration = unit.GetMovespeed() + unit.GetAddedMovespeed(); } else { navmeshAgent.speed = 0; navmeshAgent.acceleration = 0; } }