private void Update()
{
if (target != null)
{
agent.SetDestination(target.position);
// use the values to move the character
character.Move(agent.desiredVelocity, false, false);
}
else
{
// We still need to call the character's move function, but we send zeroed input as the move param.
character.Move(Vector3.zero, false, false);
}
}