Spawn and Place NavMeshAgents on a NavMesh at Runtime | AI Series Part 4
Published: 02 Mar 2021
In this tutorial I show you how to dynamically spawn NavMeshAgents into your scene at runtime, at a random position on the NavMesh. We utilize NavMeshTriangulation and NavMesh.SamplePosition to find a valid location on the NavMesh, and spawn them from our Object Pool in a Coroutine.
🔶 ALL THINGS LlamAcademy now available at: https://llamacademy.dev/support including latest tutorials, courses, ways to support, and more! Check it out 🙂
👨💻 Get the FULL FREE PROJECT on GitHub: https://github.com/llamacademy/ai-series-part-4
🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: https://www.jetbrains.com/store/?section=personal&billing=yearly
📚 Resources
🟠 If you are not familiar with Coroutines, check out the Introduction to Coroutines Video: https://www.youtube.com/watch?v=FfgI0BJ38P4
🟠 If you are not familiar with Object Pooling, check out the Introduction to Object Pooling in Unity video: https://www.youtube.com/watch?v=fsDE_mO4RZM
As usual with the AI Series, we're using the NavMesh Components: https://docs.unity3d.com/Manual/NavMesh-BuildingComponents.html not the built-in navigation system.
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.