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.


๐Ÿ‘จโ€๐Ÿ’ป As always, all code from this video is available 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


๐Ÿงก Believe in LlamAcademy's mission and have received value from the videos? Here's how you can show your support:

๐ŸŒŸ Patreon: https://www.patreon.com/llamacademy

๐ŸŒŸ YouTube Member: https://www.youtube.com/channel/UCnWm6pMD38R1E2vCAByGb6w/join or click the Join button on any video

๐Ÿ“š Take my Unity ShaderGraph Course:

https://www.gamedev.tv/p/unity-shader-graph?affcode=45216_kuvg0bp7

๐Ÿ‘• Get yourself some LlamAcademy merch: https://llamacademy.myspreadshop.com/

๐Ÿ’ธ Use my Affiliate Link for Humble Bundles https://humblebundleinc.sjv.io/9g4ak4

๐Ÿ’ธ Publisher Sale! 50% OFF an entire publisher's Assets! Publisher changes weekly! https://assetstore.unity.com/publisher-sale?aid=1101l9QvC (affiliate)

๐Ÿ’ธ Save up to 50% on NEW Assets: https://assetstore.unity.com/?new_sale=true&orderBy=1&aid=1101l9QvC (affiliate)


Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.


Connect on Social Media

Some links may be affiliate links, which at no additional cost to you, gives LlamAcademy a small portion of the purchase.