Navmesh toggle

Is there a way to toggle the navmesh agent.stop and agent.resume like “animator.enabled = !animator.enabled.”

void Update() {
	if (Input.GetKeyDown ("k")) {
		//stops animation
		anim.enabled = !anim.enabled;
		agent.velocity =;
		agent.Stop(); //????
		print ("Animation and motion paused.");


Just assign your navmeshagent as a variable, then call those public functions. You obviously know them both arleady.



It is a little confusing how it is a class.