NavMesh unwanted islands

My map mesh is quite large and I used the min region area setting to remove most of the islands which formed under buildings. However a few such islands still exist even when the islands are obviously smaller than the min region area setting (which is 20,000). Either I am not understanding this setting correctly or this looks like a bug in the NavMesh feature. My enemy AIs sometimes spawn in these islands which are inside of the mesh so they[27105-screenshot+2014-05-30+14.02.55.png|27105] cannot be seen or reached. I am using SamplePosition with a random generated position within the NavMesh. I have included a screenshot taken from underneath the NavMesh to clearly show an island and the NavMesh Bake settings.

The NavMesh is an awesome feature and I would like to learn how to avoid these islands or how to program around them.[27105-screenshot+2014-05-30+14.02.55.png|27105]

Try using the free Navmesh Cleaner asset. It automatically creates NonWalkable volumes around areas that don’t seem reachable. However, it doesn’t take NavMeshLinks into account, but you can place a bunch of walkable indicators to allow generation on those desired islands.

To use it with NavMeshComponents, you need to make this change:

diff --git a/Assets/NavMeshCleaner/Script/NavMeshCleaner.cs b/Assets/NavMeshCleaner/Script/NavMeshCleaner.cs
index 2ba98ce..7d366bb 100644
--- a/Assets/NavMeshCleaner/Script/NavMeshCleaner.cs
+++ b/Assets/NavMeshCleaner/Script/NavMeshCleaner.cs
@@ -1,4 +1,8 @@
-using System.Collections.Generic;
+// Enable define if using Unity's new NavMeshComponents:
+using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.AI;
@@ -76,7 +80,14 @@ public class NavMeshCleaner : MonoBehaviour
                 o.transform.localPosition =;
                 o.transform.localRotation = Quaternion.identity;
                 GameObjectUtility.SetStaticEditorFlags(o, GameObjectUtility.GetStaticEditorFlags(gameObject) | StaticEditorFlags.NavigationStatic);
+                var modifier = o.AddComponent<NavMeshModifier>();
+                modifier.overrideArea = true;
+                modifier.area = 1;
                 GameObjectUtility.SetNavMeshArea(o, 1);
                 Undo.RegisterCreatedObjectUndo(o, "");

There is no answer or solution to this. It’s basically careless and unprofessional programming that is rife within the Unity code.

Just solved this issue for myself.

if (NavMesh.SamplePosition(hit.point, out NavMeshHit nmHit, 2f, NavMesh.AllAreas))
	// Test if sampled position can be reached from NavMeshAgent's current position (is not an island)
	var testPath = new NavMeshPath();
	_navMeshAgent.CalculatePath(nmHit.position, testPath);

	// If reachable, use it
	if (testPath.status == NavMeshPathStatus.PathComplete)
		return nmHit.position;
        // retry

In OP’s case, just use CalculatePath to a ‘known good’ part of the map after spawning an enemy. If PathComplete is false, then they are on an island, so move them somewhere else and check CalculatePath again.