Controlling the lifetime of the NavMesh instance

Occasionally, we need to create navigation on the go because the topology is unknown. This is crucial when dealing with procedural-generated levels. One of the options is to bake the NavMesh at runtime, as we learned before. However, it could be a problem if level topology is really big or complex. Luckily, the NavMesh components developed by Unity can help us with this task, taking a different approach.

In this recipe, we will learn how to create a NavMesh around an agent without a NavMesh volume, making use of the NavMesh components.

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.