How do I change Nav Mesh Agent Speed with c# Script ?

I have several “Nav Mesh Agents” in my program and I want to assign certain variables randomly.

In the Inspector/NavMeshAgent, I know how to set my agents Speed and Acceleration manually. And I know how to create random numbers using Random.Range(min, max)…no problem there.

I simply cannot find the unity/C# syntax to assign random values to those attributes.

I would take a look at the documentation for NavMeshAgent, it will cover all the functions you can use by script.

So you can set the speed at random, with an idea like GetComponent<NavMeshAgent>().speed = Random.Range(0.1f, 10.0f); as an example.

@Dibbie how do i change values to stop distance? this.GetComponent().stoppingDistance = 0.001f; how?