Connect NavMeshes on Additively Loaded Scenes | AI Series Part 16
Published: 25 May 2021
In this tutorial I show how to connect prebaked NavMeshes on different scenes together. This is a really common problem when you load a scene using SceneLoadMode.Additive. We'll connect the additively loaded scenes' already baked NavMeshes by setting up a set of NavMeshLinks in the second scenes that hook back to the previous scene. When a player comes nearby, the second scene's NavMeshLinks will allow the player to hop over to the scene that was loaded additively without any issues.
I also put some enhancements to how the PlayerMovement works. You may have noticed when clicking to move, sometimes it got kind of hard to move around. This was because there were a bunch of colliders from the enemies we added starting in AI Series Part 7 (https://youtube.com/watch?v=QzitQSLhfG0) and we kept adding more! These colliders get in the way of the click to move. We'll update our Physics.Raycast call to filter based on a LayerMask so it only will only find targets on a particular set of layers, in this case, the Floor layer, so we don't hit any enemy colliders anymore when we click!
This was a question asked in the comment section by "you slug"! This was a really great topic to cover that affects a large variety of games! Thank you for the idea!
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.
🔶 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-16
🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: https://www.jetbrains.com/store/?section=personal&billing=yearly
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.