How it works...

By importing the NavMeshComponents directory, we are able to manipulate meshes and their surfaces via the NavMeshSurface component, using their up vector to detect the movement areas.

In the second member function, we take advantage of the coroutines' system to avoid freezing our game in case a surface is too complex to handle fast. Also, we make use of the delegate system to trigger an event when all the navigation meshes have been built on all the surfaces.

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.