Shortest Path for Agents

Hi everyone.

Firstly, I am very fresh about navmesh and I am trying to create the shortest path for the agent. My question is how I will get two different targets for my agent and they should go to a shorter one.

Can you help me to handle my problem?

Thank you for your answers

This is probably an excellent starting point:

https://docs.unity3d.com/ScriptReference/AI.NavMesh.CalculatePath.html