Explorar el Código

Initial commit

James Peret hace 2 años
commit
19964d2185
Se han modificado 78 ficheros con 3628 adiciones y 0 borrados
  1. 12 0
      .gitattributes
  2. 71 0
      .gitignore
  3. 8 0
      Assets.meta
  4. BIN
      Assets/Examples.zip
  5. 7 0
      Assets/Examples.zip.meta
  6. 9 0
      Assets/Gizmos.meta
  7. BIN
      Assets/Gizmos/NavMeshLink Icon.png
  8. 68 0
      Assets/Gizmos/NavMeshLink Icon.png.meta
  9. BIN
      Assets/Gizmos/NavMeshModifierVolume Icon.png
  10. 68 0
      Assets/Gizmos/NavMeshModifierVolume Icon.png.meta
  11. BIN
      Assets/Gizmos/NavMeshSurface Icon.png
  12. 68 0
      Assets/Gizmos/NavMeshSurface Icon.png.meta
  13. 9 0
      Assets/NavMeshComponents.meta
  14. 9 0
      Assets/NavMeshComponents/Editor.meta
  15. 325 0
      Assets/NavMeshComponents/Editor/NavMeshAssetManager.cs
  16. 11 0
      Assets/NavMeshComponents/Editor/NavMeshAssetManager.cs.meta
  17. 16 0
      Assets/NavMeshComponents/Editor/NavMeshComponentsEditor.asmdef
  18. 7 0
      Assets/NavMeshComponents/Editor/NavMeshComponentsEditor.asmdef.meta
  19. 258 0
      Assets/NavMeshComponents/Editor/NavMeshComponentsGUIUtility.cs
  20. 12 0
      Assets/NavMeshComponents/Editor/NavMeshComponentsGUIUtility.cs.meta
  21. 279 0
      Assets/NavMeshComponents/Editor/NavMeshLinkEditor.cs
  22. 12 0
      Assets/NavMeshComponents/Editor/NavMeshLinkEditor.cs.meta
  23. 49 0
      Assets/NavMeshComponents/Editor/NavMeshModifierEditor.cs
  24. 12 0
      Assets/NavMeshComponents/Editor/NavMeshModifierEditor.cs.meta
  25. 146 0
      Assets/NavMeshComponents/Editor/NavMeshModifierVolumeEditor.cs
  26. 12 0
      Assets/NavMeshComponents/Editor/NavMeshModifierVolumeEditor.cs.meta
  27. 400 0
      Assets/NavMeshComponents/Editor/NavMeshSurfaceEditor.cs
  28. 12 0
      Assets/NavMeshComponents/Editor/NavMeshSurfaceEditor.cs.meta
  29. 9 0
      Assets/NavMeshComponents/Scripts.meta
  30. 12 0
      Assets/NavMeshComponents/Scripts/NavMeshComponents.asmdef
  31. 7 0
      Assets/NavMeshComponents/Scripts/NavMeshComponents.asmdef.meta
  32. 172 0
      Assets/NavMeshComponents/Scripts/NavMeshLink.cs
  33. 12 0
      Assets/NavMeshComponents/Scripts/NavMeshLink.cs.meta
  34. 54 0
      Assets/NavMeshComponents/Scripts/NavMeshModifier.cs
  35. 12 0
      Assets/NavMeshComponents/Scripts/NavMeshModifier.cs.meta
  36. 54 0
      Assets/NavMeshComponents/Scripts/NavMeshModifierVolume.cs
  37. 12 0
      Assets/NavMeshComponents/Scripts/NavMeshModifierVolume.cs.meta
  38. 486 0
      Assets/NavMeshComponents/Scripts/NavMeshSurface.cs
  39. 12 0
      Assets/NavMeshComponents/Scripts/NavMeshSurface.cs.meta
  40. BIN
      Assets/Tests.zip
  41. 7 0
      Assets/Tests.zip.meta
  42. 8 0
      Documentation.meta
  43. 13 0
      Documentation/ConnectingSurfaces.md
  44. 7 0
      Documentation/ConnectingSurfaces.md.meta
  45. 8 0
      Documentation/Images.meta
  46. BIN
      Documentation/Images/ConnectingSurfaces-Example.png
  47. 91 0
      Documentation/Images/ConnectingSurfaces-Example.png.meta
  48. BIN
      Documentation/Images/NavMeshLink-Example.png
  49. 91 0
      Documentation/Images/NavMeshLink-Example.png.meta
  50. BIN
      Documentation/Images/NavMeshModifier-Example.png
  51. 91 0
      Documentation/Images/NavMeshModifier-Example.png.meta
  52. BIN
      Documentation/Images/NavMeshModifierVolume-Example.png
  53. 91 0
      Documentation/Images/NavMeshModifierVolume-Example.png.meta
  54. BIN
      Documentation/Images/NavMeshSurface-Advanced.png
  55. 91 0
      Documentation/Images/NavMeshSurface-Advanced.png.meta
  56. BIN
      Documentation/Images/NavMeshSurface-Example.png
  57. 91 0
      Documentation/Images/NavMeshSurface-Example.png.meta
  58. 16 0
      Documentation/NavMeshLink.md
  59. 7 0
      Documentation/NavMeshLink.md.meta
  60. 18 0
      Documentation/NavMeshModifier.md
  61. 7 0
      Documentation/NavMeshModifier.md.meta
  62. 16 0
      Documentation/NavMeshModifierVolume.md
  63. 7 0
      Documentation/NavMeshModifierVolume.md.meta
  64. 37 0
      Documentation/NavMeshSurface.md
  65. 7 0
      Documentation/NavMeshSurface.md.meta
  66. 15 0
      Documentation/README.md
  67. 7 0
      Documentation/README.md.meta
  68. 21 0
      LICENSE
  69. 7 0
      LICENSE.meta
  70. 8 0
      Packages.meta
  71. 40 0
      Packages/manifest.json
  72. 7 0
      Packages/manifest.json.meta
  73. BIN
      ProjectSettings.zip
  74. 7 0
      ProjectSettings.zip.meta
  75. 60 0
      README.md
  76. 7 0
      README.md.meta
  77. 16 0
      package.json
  78. 7 0
      package.json.meta

+ 12 - 0
.gitattributes

@@ -0,0 +1,12 @@
+*         text=auto
+# Text files
+*.cs diff=csharp text
+*.txt     text
+*.mat     text
+*.shader  text
+*.meta    text
+*.md5     text
+*.compute text
+*.md      text
+*/ProjectSettings/*.asset text
+

+ 71 - 0
.gitignore

@@ -0,0 +1,71 @@
+# This .gitignore file should be placed at the root of your Unity project directory
+#
+# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
+#
+/[Ll]ibrary/
+/[Tt]emp/
+/[Oo]bj/
+/[Bb]uild/
+/[Bb]uilds/
+/[Ll]ogs/
+/[Uu]ser[Ss]ettings/
+
+# MemoryCaptures can get excessive in size.
+# They also could contain extremely sensitive data
+/[Mm]emoryCaptures/
+
+# Asset meta data should only be ignored when the corresponding asset is also ignored
+!/[Aa]ssets/**/*.meta
+
+# Uncomment this line if you wish to ignore the asset store tools plugin
+# /[Aa]ssets/AssetStoreTools*
+
+# Autogenerated Jetbrains Rider plugin
+/[Aa]ssets/Plugins/Editor/JetBrains*
+
+# Visual Studio cache directory
+.vs/
+
+# Gradle cache directory
+.gradle/
+
+# Autogenerated VS/MD/Consulo solution and project files
+ExportedObj/
+.consulo/
+*.csproj
+*.unityproj
+*.sln
+*.suo
+*.tmp
+*.user
+*.userprefs
+*.pidb
+*.booproj
+*.svd
+*.pdb
+*.mdb
+*.opendb
+*.VC.db
+
+# Unity3D generated meta files
+*.pidb.meta
+*.pdb.meta
+*.mdb.meta
+
+# Unity3D generated file on crash reports
+sysinfo.txt
+
+# Builds
+*.apk
+*.aab
+*.unitypackage
+
+# Crashlytics generated file
+crashlytics-build.properties
+
+# Packed Addressables
+/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
+
+# Temporary auto-generated Android Assets
+/[Aa]ssets/[Ss]treamingAssets/aa.meta
+/[Aa]ssets/[Ss]treamingAssets/aa/*

+ 8 - 0
Assets.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b52e298e6c457e041b111a0587410f89
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Examples.zip


+ 7 - 0
Assets/Examples.zip.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ad382c9db191b754fbdb77579cea07d2
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/Gizmos.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 93b9715f5a4bf471c8154f6cbab7e94d
+folderAsset: yes
+timeCreated: 1477656493
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Gizmos/NavMeshLink Icon.png


+ 68 - 0
Assets/Gizmos/NavMeshLink Icon.png.meta

@@ -0,0 +1,68 @@
+fileFormatVersion: 2
+guid: 92f4afa3e25264f5b964937ccea49ff2
+timeCreated: 1477656497
+licenseType: Pro
+TextureImporter:
+  fileIDToRecycleName: {}
+  serializedVersion: 4
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    filterMode: -1
+    aniso: -1
+    mipBias: -1
+    wrapMode: -1
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spritePixelsToUnits: 100
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  platformSettings:
+  - buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+  spritePackingTag: 
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Gizmos/NavMeshModifierVolume Icon.png


+ 68 - 0
Assets/Gizmos/NavMeshModifierVolume Icon.png.meta

@@ -0,0 +1,68 @@
+fileFormatVersion: 2
+guid: cc7b9475dbddf4f9088d327d6e10ab77
+timeCreated: 1477656497
+licenseType: Pro
+TextureImporter:
+  fileIDToRecycleName: {}
+  serializedVersion: 4
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    filterMode: -1
+    aniso: -1
+    mipBias: -1
+    wrapMode: -1
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spritePixelsToUnits: 100
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  platformSettings:
+  - buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+  spritePackingTag: 
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Gizmos/NavMeshSurface Icon.png


+ 68 - 0
Assets/Gizmos/NavMeshSurface Icon.png.meta

@@ -0,0 +1,68 @@
+fileFormatVersion: 2
+guid: e4f97225bcfb64760a1c81f460837f01
+timeCreated: 1477656497
+licenseType: Pro
+TextureImporter:
+  fileIDToRecycleName: {}
+  serializedVersion: 4
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    filterMode: -1
+    aniso: -1
+    mipBias: -1
+    wrapMode: -1
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spritePixelsToUnits: 100
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  platformSettings:
+  - buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+  spritePackingTag: 
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/NavMeshComponents.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 90490f1de0cc846679dcec6f99663653
+folderAsset: yes
+timeCreated: 1477656493
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/NavMeshComponents/Editor.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 63b588f3892bb4b5eb73ad3d2791e05c
+folderAsset: yes
+timeCreated: 1477656493
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 325 - 0
Assets/NavMeshComponents/Editor/NavMeshAssetManager.cs

@@ -0,0 +1,325 @@
+using System.Collections.Generic;
+using System.IO;
+using UnityEditor.Experimental.SceneManagement;
+using UnityEditor.SceneManagement;
+using UnityEngine.AI;
+using UnityEngine;
+
+namespace UnityEditor.AI
+{
+    public class NavMeshAssetManager : ScriptableSingleton<NavMeshAssetManager>
+    {
+        internal struct AsyncBakeOperation
+        {
+            public NavMeshSurface surface;
+            public NavMeshData bakeData;
+            public AsyncOperation bakeOperation;
+        }
+
+        List<AsyncBakeOperation> m_BakeOperations = new List<AsyncBakeOperation>();
+        internal List<AsyncBakeOperation> GetBakeOperations() { return m_BakeOperations; }
+
+        struct SavedPrefabNavMeshData
+        {
+            public NavMeshSurface surface;
+            public NavMeshData navMeshData;
+        }
+
+        List<SavedPrefabNavMeshData> m_PrefabNavMeshDataAssets = new List<SavedPrefabNavMeshData>();
+
+        static string GetAndEnsureTargetPath(NavMeshSurface surface)
+        {
+            // Create directory for the asset if it does not exist yet.
+            var activeScenePath = surface.gameObject.scene.path;
+
+            var targetPath = "Assets";
+            if (!string.IsNullOrEmpty(activeScenePath))
+            {
+                targetPath = Path.Combine(Path.GetDirectoryName(activeScenePath), Path.GetFileNameWithoutExtension(activeScenePath));
+            }
+            else
+            {
+                var prefabStage = PrefabStageUtility.GetPrefabStage(surface.gameObject);
+                var isPartOfPrefab = prefabStage != null && prefabStage.IsPartOfPrefabContents(surface.gameObject);
+                if (isPartOfPrefab && !string.IsNullOrEmpty(prefabStage.prefabAssetPath))
+                {
+                    var prefabDirectoryName = Path.GetDirectoryName(prefabStage.prefabAssetPath);
+                    if (!string.IsNullOrEmpty(prefabDirectoryName))
+                        targetPath = prefabDirectoryName;
+                }
+            }
+            if (!Directory.Exists(targetPath))
+                Directory.CreateDirectory(targetPath);
+            return targetPath;
+        }
+
+        static void CreateNavMeshAsset(NavMeshSurface surface)
+        {
+            var targetPath = GetAndEnsureTargetPath(surface);
+
+            var combinedAssetPath = Path.Combine(targetPath, "NavMesh-" + surface.name + ".asset");
+            combinedAssetPath = AssetDatabase.GenerateUniqueAssetPath(combinedAssetPath);
+            AssetDatabase.CreateAsset(surface.navMeshData, combinedAssetPath);
+        }
+
+        NavMeshData GetNavMeshAssetToDelete(NavMeshSurface navSurface)
+        {
+            if (PrefabUtility.IsPartOfPrefabInstance(navSurface) && !PrefabUtility.IsPartOfModelPrefab(navSurface))
+            {
+                // Don't allow deleting the asset belonging to the prefab parent
+                var parentSurface = PrefabUtility.GetCorrespondingObjectFromSource(navSurface) as NavMeshSurface;
+                if (parentSurface && navSurface.navMeshData == parentSurface.navMeshData)
+                    return null;
+            }
+
+            // Do not delete the NavMeshData asset referenced from a prefab until the prefab is saved
+            var prefabStage = PrefabStageUtility.GetPrefabStage(navSurface.gameObject);
+            var isPartOfPrefab = prefabStage != null && prefabStage.IsPartOfPrefabContents(navSurface.gameObject);
+            if (isPartOfPrefab && IsCurrentPrefabNavMeshDataStored(navSurface))
+                return null;
+
+            return navSurface.navMeshData;
+        }
+
+        void ClearSurface(NavMeshSurface navSurface)
+        {
+            var hasNavMeshData = navSurface.navMeshData != null;
+            StoreNavMeshDataIfInPrefab(navSurface);
+
+            var assetToDelete = GetNavMeshAssetToDelete(navSurface);
+            navSurface.RemoveData();
+
+            if (hasNavMeshData)
+            {
+                SetNavMeshData(navSurface, null);
+                EditorSceneManager.MarkSceneDirty(navSurface.gameObject.scene);
+            }
+
+            if (assetToDelete)
+                AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(assetToDelete));
+        }
+
+        public void StartBakingSurfaces(UnityEngine.Object[] surfaces)
+        {
+            // Remove first to avoid double registration of the callback
+            EditorApplication.update -= UpdateAsyncBuildOperations;
+            EditorApplication.update += UpdateAsyncBuildOperations;
+
+            foreach (NavMeshSurface surf in surfaces)
+            {
+                StoreNavMeshDataIfInPrefab(surf);
+
+                var oper = new AsyncBakeOperation();
+
+                oper.bakeData = InitializeBakeData(surf);
+                oper.bakeOperation = surf.UpdateNavMesh(oper.bakeData);
+                oper.surface = surf;
+
+                m_BakeOperations.Add(oper);
+            }
+        }
+
+        static NavMeshData InitializeBakeData(NavMeshSurface surface)
+        {
+            var emptySources = new List<NavMeshBuildSource>();
+            var emptyBounds = new Bounds();
+            return UnityEngine.AI.NavMeshBuilder.BuildNavMeshData(surface.GetBuildSettings(), emptySources, emptyBounds
+                , surface.transform.position, surface.transform.rotation);
+        }
+
+        void UpdateAsyncBuildOperations()
+        {
+            foreach (var oper in m_BakeOperations)
+            {
+                if (oper.surface == null || oper.bakeOperation == null)
+                    continue;
+
+                if (oper.bakeOperation.isDone)
+                {
+                    var surface = oper.surface;
+                    var delete = GetNavMeshAssetToDelete(surface);
+                    if (delete != null)
+                        AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(delete));
+
+                    surface.RemoveData();
+                    SetNavMeshData(surface, oper.bakeData);
+
+                    if (surface.isActiveAndEnabled)
+                        surface.AddData();
+                    CreateNavMeshAsset(surface);
+                    EditorSceneManager.MarkSceneDirty(surface.gameObject.scene);
+                }
+            }
+            m_BakeOperations.RemoveAll(o => o.bakeOperation == null || o.bakeOperation.isDone);
+            if (m_BakeOperations.Count == 0)
+                EditorApplication.update -= UpdateAsyncBuildOperations;
+        }
+
+        public bool IsSurfaceBaking(NavMeshSurface surface)
+        {
+            if (surface == null)
+                return false;
+
+            foreach (var oper in m_BakeOperations)
+            {
+                if (oper.surface == null || oper.bakeOperation == null)
+                    continue;
+
+                if (oper.surface == surface)
+                    return true;
+            }
+
+            return false;
+        }
+
+        public void ClearSurfaces(UnityEngine.Object[] surfaces)
+        {
+            foreach (NavMeshSurface s in surfaces)
+                ClearSurface(s);
+        }
+
+        static void SetNavMeshData(NavMeshSurface navSurface, NavMeshData navMeshData)
+        {
+            var so = new SerializedObject(navSurface);
+            var navMeshDataProperty = so.FindProperty("m_NavMeshData");
+            navMeshDataProperty.objectReferenceValue = navMeshData;
+            so.ApplyModifiedPropertiesWithoutUndo();
+        }
+
+        void StoreNavMeshDataIfInPrefab(NavMeshSurface surfaceToStore)
+        {
+            var prefabStage = PrefabStageUtility.GetPrefabStage(surfaceToStore.gameObject);
+            var isPartOfPrefab = prefabStage != null && prefabStage.IsPartOfPrefabContents(surfaceToStore.gameObject);
+            if (!isPartOfPrefab)
+                return;
+
+            // check if data has already been stored for this surface
+            foreach (var storedAssetInfo in m_PrefabNavMeshDataAssets)
+                if (storedAssetInfo.surface == surfaceToStore)
+                    return;
+
+            if (m_PrefabNavMeshDataAssets.Count == 0)
+            {
+                PrefabStage.prefabSaving -= DeleteStoredNavMeshDataAssetsForOwnedSurfaces;
+                PrefabStage.prefabSaving += DeleteStoredNavMeshDataAssetsForOwnedSurfaces;
+
+                PrefabStage.prefabStageClosing -= ForgetUnsavedNavMeshDataChanges;
+                PrefabStage.prefabStageClosing += ForgetUnsavedNavMeshDataChanges;
+            }
+
+            var isDataOwner = true;
+            if (PrefabUtility.IsPartOfPrefabInstance(surfaceToStore) && !PrefabUtility.IsPartOfModelPrefab(surfaceToStore))
+            {
+                var basePrefabSurface = PrefabUtility.GetCorrespondingObjectFromSource(surfaceToStore) as NavMeshSurface;
+                isDataOwner = basePrefabSurface == null || surfaceToStore.navMeshData != basePrefabSurface.navMeshData;
+            }
+            m_PrefabNavMeshDataAssets.Add(new SavedPrefabNavMeshData { surface = surfaceToStore, navMeshData = isDataOwner ? surfaceToStore.navMeshData : null });
+        }
+
+        bool IsCurrentPrefabNavMeshDataStored(NavMeshSurface surface)
+        {
+            if (surface == null)
+                return false;
+
+            foreach (var storedAssetInfo in m_PrefabNavMeshDataAssets)
+            {
+                if (storedAssetInfo.surface == surface)
+                    return storedAssetInfo.navMeshData == surface.navMeshData;
+            }
+
+            return false;
+        }
+
+        void DeleteStoredNavMeshDataAssetsForOwnedSurfaces(GameObject gameObjectInPrefab)
+        {
+            // Debug.LogFormat("DeleteStoredNavMeshDataAsset() when saving prefab {0}", gameObjectInPrefab.name);
+
+            var surfaces = gameObjectInPrefab.GetComponentsInChildren<NavMeshSurface>(true);
+            foreach (var surface in surfaces)
+                DeleteStoredPrefabNavMeshDataAsset(surface);
+        }
+
+        void DeleteStoredPrefabNavMeshDataAsset(NavMeshSurface surface)
+        {
+            for (var i = m_PrefabNavMeshDataAssets.Count - 1; i >= 0; i--)
+            {
+                var storedAssetInfo = m_PrefabNavMeshDataAssets[i];
+                if (storedAssetInfo.surface == surface)
+                {
+                    var storedNavMeshData = storedAssetInfo.navMeshData;
+                    if (storedNavMeshData != null && storedNavMeshData != surface.navMeshData)
+                    {
+                        var assetPath = AssetDatabase.GetAssetPath(storedNavMeshData);
+                        AssetDatabase.DeleteAsset(assetPath);
+                    }
+
+                    m_PrefabNavMeshDataAssets.RemoveAt(i);
+                    break;
+                }
+            }
+
+            if (m_PrefabNavMeshDataAssets.Count == 0)
+            {
+                PrefabStage.prefabSaving -= DeleteStoredNavMeshDataAssetsForOwnedSurfaces;
+                PrefabStage.prefabStageClosing -= ForgetUnsavedNavMeshDataChanges;
+            }
+        }
+
+        void ForgetUnsavedNavMeshDataChanges(PrefabStage prefabStage)
+        {
+            // Debug.Log("On prefab closing - forget about this object's surfaces and stop caring about prefab saving");
+
+            if (prefabStage == null)
+                return;
+
+            var allSurfacesInPrefab = prefabStage.prefabContentsRoot.GetComponentsInChildren<NavMeshSurface>(true);
+            NavMeshSurface surfaceInPrefab = null;
+            var index = 0;
+            do
+            {
+                if (allSurfacesInPrefab.Length > 0)
+                    surfaceInPrefab = allSurfacesInPrefab[index];
+
+                for (var i = m_PrefabNavMeshDataAssets.Count - 1; i >= 0; i--)
+                {
+                    var storedPrefabInfo = m_PrefabNavMeshDataAssets[i];
+                    if (storedPrefabInfo.surface == null)
+                    {
+                        // Debug.LogFormat("A surface from the prefab got deleted after it has baked a new NavMesh but it hasn't saved it. Now the unsaved asset gets deleted. ({0})", storedPrefabInfo.navMeshData);
+
+                        // surface got deleted, thus delete its initial NavMeshData asset
+                        if (storedPrefabInfo.navMeshData != null)
+                        {
+                            var assetPath = AssetDatabase.GetAssetPath(storedPrefabInfo.navMeshData);
+                            AssetDatabase.DeleteAsset(assetPath);
+                        }
+
+                        m_PrefabNavMeshDataAssets.RemoveAt(i);
+                    }
+                    else if (surfaceInPrefab != null && storedPrefabInfo.surface == surfaceInPrefab)
+                    {
+                        //Debug.LogFormat("The surface {0} from the prefab was storing the original navmesh data and now will be forgotten", surfaceInPrefab);
+
+                        var baseSurface = PrefabUtility.GetCorrespondingObjectFromSource(surfaceInPrefab) as NavMeshSurface;
+                        if (baseSurface == null || surfaceInPrefab.navMeshData != baseSurface.navMeshData)
+                        {
+                            var assetPath = AssetDatabase.GetAssetPath(surfaceInPrefab.navMeshData);
+                            AssetDatabase.DeleteAsset(assetPath);
+
+                            //Debug.LogFormat("The surface {0} from the prefab has baked new NavMeshData but did not save this change so the asset has been now deleted. ({1})",
+                            //    surfaceInPrefab, assetPath);
+                        }
+
+                        m_PrefabNavMeshDataAssets.RemoveAt(i);
+                    }
+                }
+            } while (++index < allSurfacesInPrefab.Length);
+
+            if (m_PrefabNavMeshDataAssets.Count == 0)
+            {
+                PrefabStage.prefabSaving -= DeleteStoredNavMeshDataAssetsForOwnedSurfaces;
+                PrefabStage.prefabStageClosing -= ForgetUnsavedNavMeshDataChanges;
+            }
+        }
+    }
+}

+ 11 - 0
Assets/NavMeshComponents/Editor/NavMeshAssetManager.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 178d8366aa1616849b91b66285c51454
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 16 - 0
Assets/NavMeshComponents/Editor/NavMeshComponentsEditor.asmdef

@@ -0,0 +1,16 @@
+{
+    "name": "NavMeshComponentsEditor",
+    "references": [
+        "NavMeshComponents"
+    ],
+    "optionalUnityReferences": [],
+    "includePlatforms": [
+        "Editor"
+    ],
+    "excludePlatforms": [],
+    "allowUnsafeCode": false,
+    "overrideReferences": false,
+    "precompiledReferences": [],
+    "autoReferenced": true,
+    "defineConstraints": []
+}

+ 7 - 0
Assets/NavMeshComponents/Editor/NavMeshComponentsEditor.asmdef.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 86c9d8e67265f41469be06142c397d17
+AssemblyDefinitionImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 258 - 0
Assets/NavMeshComponents/Editor/NavMeshComponentsGUIUtility.cs

@@ -0,0 +1,258 @@
+using UnityEngine;
+using UnityEngine.AI;
+
+namespace UnityEditor.AI
+{
+    public static class NavMeshComponentsGUIUtility
+    {
+        public static void AreaPopup(string labelName, SerializedProperty areaProperty)
+        {
+            var areaIndex = -1;
+            var areaNames = GameObjectUtility.GetNavMeshAreaNames();
+            for (var i = 0; i < areaNames.Length; i++)
+            {
+                var areaValue = GameObjectUtility.GetNavMeshAreaFromName(areaNames[i]);
+                if (areaValue == areaProperty.intValue)
+                    areaIndex = i;
+            }
+            ArrayUtility.Add(ref areaNames, "");
+            ArrayUtility.Add(ref areaNames, "Open Area Settings...");
+
+            var rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
+            EditorGUI.BeginProperty(rect, GUIContent.none, areaProperty);
+
+            EditorGUI.BeginChangeCheck();
+            areaIndex = EditorGUI.Popup(rect, labelName, areaIndex, areaNames);
+
+            if (EditorGUI.EndChangeCheck())
+            {
+                if (areaIndex >= 0 && areaIndex < areaNames.Length - 2)
+                    areaProperty.intValue = GameObjectUtility.GetNavMeshAreaFromName(areaNames[areaIndex]);
+                else if (areaIndex == areaNames.Length - 1)
+                    NavMeshEditorHelpers.OpenAreaSettings();
+            }
+
+            EditorGUI.EndProperty();
+        }
+
+        public static void AgentTypePopup(string labelName, SerializedProperty agentTypeID)
+        {
+            var index = -1;
+            var count = NavMesh.GetSettingsCount();
+            var agentTypeNames = new string[count + 2];
+            for (var i = 0; i < count; i++)
+            {
+                var id = NavMesh.GetSettingsByIndex(i).agentTypeID;
+                var name = NavMesh.GetSettingsNameFromID(id);
+                agentTypeNames[i] = name;
+                if (id == agentTypeID.intValue)
+                    index = i;
+            }
+            agentTypeNames[count] = "";
+            agentTypeNames[count + 1] = "Open Agent Settings...";
+
+            bool validAgentType = index != -1;
+            if (!validAgentType)
+            {
+                EditorGUILayout.HelpBox("Agent Type invalid.", MessageType.Warning);
+            }
+
+            var rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
+            EditorGUI.BeginProperty(rect, GUIContent.none, agentTypeID);
+
+            EditorGUI.BeginChangeCheck();
+            index = EditorGUI.Popup(rect, labelName, index, agentTypeNames);
+            if (EditorGUI.EndChangeCheck())
+            {
+                if (index >= 0 && index < count)
+                {
+                    var id = NavMesh.GetSettingsByIndex(index).agentTypeID;
+                    agentTypeID.intValue = id;
+                }
+                else if (index == count + 1)
+                {
+                    NavMeshEditorHelpers.OpenAgentSettings(-1);
+                }
+            }
+
+            EditorGUI.EndProperty();
+        }
+
+        // Agent mask is a set (internally array/list) of agentTypeIDs.
+        // It is used to describe which agents modifiers apply to.
+        // There is a special case of "None" which is an empty array.
+        // There is a special case of "All" which is an array of length 1, and value of -1.
+        public static void AgentMaskPopup(string labelName, SerializedProperty agentMask)
+        {
+            // Contents of the dropdown box.
+            string popupContent = "";
+
+            if (agentMask.hasMultipleDifferentValues)
+                popupContent = "\u2014";
+            else
+                popupContent = GetAgentMaskLabelName(agentMask);
+
+            var content = new GUIContent(popupContent);
+            var popupRect = GUILayoutUtility.GetRect(content, EditorStyles.popup);
+
+            EditorGUI.BeginProperty(popupRect, GUIContent.none, agentMask);
+            popupRect = EditorGUI.PrefixLabel(popupRect, 0, new GUIContent(labelName));
+            bool pressed = GUI.Button(popupRect, content, EditorStyles.popup);
+
+            if (pressed)
+            {
+                var show = !agentMask.hasMultipleDifferentValues;
+                var showNone = show && agentMask.arraySize == 0;
+                var showAll = show && IsAll(agentMask);
+
+                var menu = new GenericMenu();
+                menu.AddItem(new GUIContent("None"), showNone, SetAgentMaskNone, agentMask);
+                menu.AddItem(new GUIContent("All"), showAll, SetAgentMaskAll, agentMask);
+                menu.AddSeparator("");
+
+                var count = NavMesh.GetSettingsCount();
+                for (var i = 0; i < count; i++)
+                {
+                    var id = NavMesh.GetSettingsByIndex(i).agentTypeID;
+                    var sname = NavMesh.GetSettingsNameFromID(id);
+
+                    var showSelected = show && AgentMaskHasSelectedAgentTypeID(agentMask, id);
+                    var userData = new object[] { agentMask, id, !showSelected };
+                    menu.AddItem(new GUIContent(sname), showSelected, ToggleAgentMaskItem, userData);
+                }
+
+                menu.DropDown(popupRect);
+            }
+
+            EditorGUI.EndProperty();
+        }
+
+        public static GameObject CreateAndSelectGameObject(string suggestedName, GameObject parent)
+        {
+            var parentTransform = parent != null ? parent.transform : null;
+            var uniqueName = GameObjectUtility.GetUniqueNameForSibling(parentTransform, suggestedName);
+            var child = new GameObject(uniqueName);
+
+            Undo.RegisterCreatedObjectUndo(child, "Create " + uniqueName);
+            if (parentTransform != null)
+                Undo.SetTransformParent(child.transform, parentTransform, "Parent " + uniqueName);
+
+            Selection.activeGameObject = child;
+
+            return child;
+        }
+
+        static bool IsAll(SerializedProperty agentMask)
+        {
+            return agentMask.arraySize == 1 && agentMask.GetArrayElementAtIndex(0).intValue == -1;
+        }
+
+        static void ToggleAgentMaskItem(object userData)
+        {
+            var args = (object[])userData;
+            var agentMask = (SerializedProperty)args[0];
+            var agentTypeID = (int)args[1];
+            var value = (bool)args[2];
+
+            ToggleAgentMaskItem(agentMask, agentTypeID, value);
+        }
+
+        static void ToggleAgentMaskItem(SerializedProperty agentMask, int agentTypeID, bool value)
+        {
+            if (agentMask.hasMultipleDifferentValues)
+            {
+                agentMask.ClearArray();
+                agentMask.serializedObject.ApplyModifiedProperties();
+            }
+
+            // Find which index this agent type is in the agentMask array.
+            int idx = -1;
+            for (var j = 0; j < agentMask.arraySize; j++)
+            {
+                var elem = agentMask.GetArrayElementAtIndex(j);
+                if (elem.intValue == agentTypeID)
+                    idx = j;
+            }
+
+            // Handle "All" special case.
+            if (IsAll(agentMask))
+            {
+                agentMask.DeleteArrayElementAtIndex(0);
+            }
+
+            // Toggle value.
+            if (value)
+            {
+                if (idx == -1)
+                {
+                    agentMask.InsertArrayElementAtIndex(agentMask.arraySize);
+                    agentMask.GetArrayElementAtIndex(agentMask.arraySize - 1).intValue = agentTypeID;
+                }
+            }
+            else
+            {
+                if (idx != -1)
+                {
+                    agentMask.DeleteArrayElementAtIndex(idx);
+                }
+            }
+
+            agentMask.serializedObject.ApplyModifiedProperties();
+        }
+
+        static void SetAgentMaskNone(object data)
+        {
+            var agentMask = (SerializedProperty)data;
+            agentMask.ClearArray();
+            agentMask.serializedObject.ApplyModifiedProperties();
+        }
+
+        static void SetAgentMaskAll(object data)
+        {
+            var agentMask = (SerializedProperty)data;
+            agentMask.ClearArray();
+            agentMask.InsertArrayElementAtIndex(0);
+            agentMask.GetArrayElementAtIndex(0).intValue = -1;
+            agentMask.serializedObject.ApplyModifiedProperties();
+        }
+
+        static string GetAgentMaskLabelName(SerializedProperty agentMask)
+        {
+            if (agentMask.arraySize == 0)
+                return "None";
+
+            if (IsAll(agentMask))
+                return "All";
+
+            if (agentMask.arraySize <= 3)
+            {
+                var labelName = "";
+                for (var j = 0; j < agentMask.arraySize; j++)
+                {
+                    var elem = agentMask.GetArrayElementAtIndex(j);
+                    var settingsName = NavMesh.GetSettingsNameFromID(elem.intValue);
+                    if (string.IsNullOrEmpty(settingsName))
+                        continue;
+
+                    if (labelName.Length > 0)
+                        labelName += ", ";
+                    labelName += settingsName;
+                }
+                return labelName;
+            }
+
+            return "Mixed...";
+        }
+
+        static bool AgentMaskHasSelectedAgentTypeID(SerializedProperty agentMask, int agentTypeID)
+        {
+            for (var j = 0; j < agentMask.arraySize; j++)
+            {
+                var elem = agentMask.GetArrayElementAtIndex(j);
+                if (elem.intValue == agentTypeID)
+                    return true;
+            }
+            return false;
+        }
+    }
+}

+ 12 - 0
Assets/NavMeshComponents/Editor/NavMeshComponentsGUIUtility.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 77fba670b979046f18d52d751e0d4659
+timeCreated: 1480524815
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 279 - 0
Assets/NavMeshComponents/Editor/NavMeshLinkEditor.cs

@@ -0,0 +1,279 @@
+using UnityEngine;
+using UnityEngine.AI;
+
+namespace UnityEditor.AI
+{
+    [CanEditMultipleObjects]
+    [CustomEditor(typeof(NavMeshLink))]
+    class NavMeshLinkEditor : Editor
+    {
+        SerializedProperty m_AgentTypeID;
+        SerializedProperty m_Area;
+        SerializedProperty m_CostModifier;
+        SerializedProperty m_AutoUpdatePosition;
+        SerializedProperty m_Bidirectional;
+        SerializedProperty m_EndPoint;
+        SerializedProperty m_StartPoint;
+        SerializedProperty m_Width;
+
+        static int s_SelectedID;
+        static int s_SelectedPoint = -1;
+
+        static Color s_HandleColor = new Color(255f, 167f, 39f, 210f) / 255;
+        static Color s_HandleColorDisabled = new Color(255f * 0.75f, 167f * 0.75f, 39f * 0.75f, 100f) / 255;
+
+        void OnEnable()
+        {
+            m_AgentTypeID = serializedObject.FindProperty("m_AgentTypeID");
+            m_Area = serializedObject.FindProperty("m_Area");
+            m_CostModifier = serializedObject.FindProperty("m_CostModifier");
+            m_AutoUpdatePosition = serializedObject.FindProperty("m_AutoUpdatePosition");
+            m_Bidirectional = serializedObject.FindProperty("m_Bidirectional");
+            m_EndPoint = serializedObject.FindProperty("m_EndPoint");
+            m_StartPoint = serializedObject.FindProperty("m_StartPoint");
+            m_Width = serializedObject.FindProperty("m_Width");
+
+            s_SelectedID = 0;
+            s_SelectedPoint = -1;
+
+            NavMeshVisualizationSettings.showNavigation++;
+        }
+
+        void OnDisable()
+        {
+            NavMeshVisualizationSettings.showNavigation--;
+        }
+
+        static Matrix4x4 UnscaledLocalToWorldMatrix(Transform t)
+        {
+            return Matrix4x4.TRS(t.position, t.rotation, Vector3.one);
+        }
+
+        void AlignTransformToEndPoints(NavMeshLink navLink)
+        {
+            var mat = UnscaledLocalToWorldMatrix(navLink.transform);
+
+            var worldStartPt = mat.MultiplyPoint(navLink.startPoint);
+            var worldEndPt = mat.MultiplyPoint(navLink.endPoint);
+
+            var forward = worldEndPt - worldStartPt;
+            var up = navLink.transform.up;
+
+            // Flatten
+            forward -= Vector3.Dot(up, forward) * up;
+
+            var transform = navLink.transform;
+            transform.rotation = Quaternion.LookRotation(forward, up);
+            transform.position = (worldEndPt + worldStartPt) * 0.5f;
+            transform.localScale = Vector3.one;
+
+            navLink.startPoint = transform.InverseTransformPoint(worldStartPt);
+            navLink.endPoint = transform.InverseTransformPoint(worldEndPt);
+        }
+
+        public override void OnInspectorGUI()
+        {
+            serializedObject.Update();
+
+            NavMeshComponentsGUIUtility.AgentTypePopup("Agent Type", m_AgentTypeID);
+            EditorGUILayout.Space();
+
+            EditorGUILayout.PropertyField(m_StartPoint);
+            EditorGUILayout.PropertyField(m_EndPoint);
+
+            GUILayout.BeginHorizontal();
+            GUILayout.Space(EditorGUIUtility.labelWidth);
+            if (GUILayout.Button("Swap"))
+            {
+                foreach (NavMeshLink navLink in targets)
+                {
+                    var tmp = navLink.startPoint;
+                    navLink.startPoint = navLink.endPoint;
+                    navLink.endPoint = tmp;
+                }
+                SceneView.RepaintAll();
+            }
+            if (GUILayout.Button("Align Transform"))
+            {
+                foreach (NavMeshLink navLink in targets)
+                {
+                    Undo.RecordObject(navLink.transform, "Align Transform to End Points");
+                    Undo.RecordObject(navLink, "Align Transform to End Points");
+                    AlignTransformToEndPoints(navLink);
+                }
+                SceneView.RepaintAll();
+            }
+            GUILayout.EndHorizontal();
+            EditorGUILayout.Space();
+
+            EditorGUILayout.PropertyField(m_Width);
+            EditorGUILayout.PropertyField(m_CostModifier);
+            EditorGUILayout.PropertyField(m_AutoUpdatePosition);
+            EditorGUILayout.PropertyField(m_Bidirectional);
+
+            NavMeshComponentsGUIUtility.AreaPopup("Area Type", m_Area);
+
+            serializedObject.ApplyModifiedProperties();
+
+            EditorGUILayout.Space();
+        }
+
+        static Vector3 CalcLinkRight(NavMeshLink navLink)
+        {
+            var dir = navLink.endPoint - navLink.startPoint;
+            return (new Vector3(-dir.z, 0.0f, dir.x)).normalized;
+        }
+
+        static void DrawLink(NavMeshLink navLink)
+        {
+            var right = CalcLinkRight(navLink);
+            var rad = navLink.width * 0.5f;
+
+            Gizmos.DrawLine(navLink.startPoint - right * rad, navLink.startPoint + right * rad);
+            Gizmos.DrawLine(navLink.endPoint - right * rad, navLink.endPoint + right * rad);
+            Gizmos.DrawLine(navLink.startPoint - right * rad, navLink.endPoint - right * rad);
+            Gizmos.DrawLine(navLink.startPoint + right * rad, navLink.endPoint + right * rad);
+        }
+
+        [DrawGizmo(GizmoType.Selected | GizmoType.Active | GizmoType.Pickable)]
+        static void RenderBoxGizmo(NavMeshLink navLink, GizmoType gizmoType)
+        {
+            if (!EditorApplication.isPlaying)
+                navLink.UpdateLink();
+
+            var color = s_HandleColor;
+            if (!navLink.enabled)
+                color = s_HandleColorDisabled;
+
+            var oldColor = Gizmos.color;
+            var oldMatrix = Gizmos.matrix;
+
+            Gizmos.matrix = UnscaledLocalToWorldMatrix(navLink.transform);
+
+            Gizmos.color = color;
+            DrawLink(navLink);
+
+            Gizmos.matrix = oldMatrix;
+            Gizmos.color = oldColor;
+
+            Gizmos.DrawIcon(navLink.transform.position, "NavMeshLink Icon", true);
+        }
+
+        [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)]
+        static void RenderBoxGizmoNotSelected(NavMeshLink navLink, GizmoType gizmoType)
+        {
+            if (NavMeshVisualizationSettings.showNavigation > 0)
+            {
+                var color = s_HandleColor;
+                if (!navLink.enabled)
+                    color = s_HandleColorDisabled;
+
+                var oldColor = Gizmos.color;
+                var oldMatrix = Gizmos.matrix;
+
+                Gizmos.matrix = UnscaledLocalToWorldMatrix(navLink.transform);
+
+                Gizmos.color = color;
+                DrawLink(navLink);
+
+                Gizmos.matrix = oldMatrix;
+                Gizmos.color = oldColor;
+            }
+
+            Gizmos.DrawIcon(navLink.transform.position, "NavMeshLink Icon", true);
+        }
+
+        public void OnSceneGUI()
+        {
+            var navLink = (NavMeshLink)target;
+            if (!navLink.enabled)
+                return;
+
+            var mat = UnscaledLocalToWorldMatrix(navLink.transform);
+
+            var startPt = mat.MultiplyPoint(navLink.startPoint);
+            var endPt = mat.MultiplyPoint(navLink.endPoint);
+            var midPt = Vector3.Lerp(startPt, endPt, 0.35f);
+            var startSize = HandleUtility.GetHandleSize(startPt);
+            var endSize = HandleUtility.GetHandleSize(endPt);
+            var midSize = HandleUtility.GetHandleSize(midPt);
+
+            var zup = Quaternion.FromToRotation(Vector3.forward, Vector3.up);
+            var right = mat.MultiplyVector(CalcLinkRight(navLink));
+
+            var oldColor = Handles.color;
+            Handles.color = s_HandleColor;
+
+            Vector3 pos;
+
+            if (navLink.GetInstanceID() == s_SelectedID && s_SelectedPoint == 0)
+            {
+                EditorGUI.BeginChangeCheck();
+                Handles.CubeHandleCap(0, startPt, zup, 0.1f * startSize, Event.current.type);
+                pos = Handles.PositionHandle(startPt, navLink.transform.rotation);
+                if (EditorGUI.EndChangeCheck())
+                {
+                    Undo.RecordObject(navLink, "Move link point");
+                    navLink.startPoint = mat.inverse.MultiplyPoint(pos);
+                }
+            }
+            else
+            {
+                if (Handles.Button(startPt, zup, 0.1f * startSize, 0.1f * startSize, Handles.CubeHandleCap))
+                {
+                    s_SelectedPoint = 0;
+                    s_SelectedID = navLink.GetInstanceID();
+                }
+            }
+
+            if (navLink.GetInstanceID() == s_SelectedID && s_SelectedPoint == 1)
+            {
+                EditorGUI.BeginChangeCheck();
+                Handles.CubeHandleCap(0, endPt, zup, 0.1f * startSize, Event.current.type);
+                pos = Handles.PositionHandle(endPt, navLink.transform.rotation);
+                if (EditorGUI.EndChangeCheck())
+                {
+                    Undo.RecordObject(navLink, "Move link point");
+                    navLink.endPoint = mat.inverse.MultiplyPoint(pos);
+                }
+            }
+            else
+            {
+                if (Handles.Button(endPt, zup, 0.1f * endSize, 0.1f * endSize, Handles.CubeHandleCap))
+                {
+                    s_SelectedPoint = 1;
+                    s_SelectedID = navLink.GetInstanceID();
+                }
+            }
+
+            EditorGUI.BeginChangeCheck();
+            pos = Handles.Slider(midPt + right * navLink.width * 0.5f, right, midSize * 0.03f, Handles.DotHandleCap, 0);
+            if (EditorGUI.EndChangeCheck())
+            {
+                Undo.RecordObject(navLink, "Adjust link width");
+                navLink.width = Mathf.Max(0.0f, 2.0f * Vector3.Dot(right, (pos - midPt)));
+            }
+
+            EditorGUI.BeginChangeCheck();
+            pos = Handles.Slider(midPt - right * navLink.width * 0.5f, -right, midSize * 0.03f, Handles.DotHandleCap, 0);
+            if (EditorGUI.EndChangeCheck())
+            {
+                Undo.RecordObject(navLink, "Adjust link width");
+                navLink.width = Mathf.Max(0.0f, 2.0f * Vector3.Dot(-right, (pos - midPt)));
+            }
+
+            Handles.color = oldColor;
+        }
+
+        [MenuItem("GameObject/AI/NavMesh Link", false, 2002)]
+        static public void CreateNavMeshLink(MenuCommand menuCommand)
+        {
+            var parent = menuCommand.context as GameObject;
+            GameObject go = NavMeshComponentsGUIUtility.CreateAndSelectGameObject("NavMesh Link", parent);
+            go.AddComponent<NavMeshLink>();
+            var view = SceneView.lastActiveSceneView;
+            if (view != null)
+                view.MoveToView(go.transform);
+        }
+    }
+}

+ 12 - 0
Assets/NavMeshComponents/Editor/NavMeshLinkEditor.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ece1e865d1ad84587872fe8580ab5a20
+timeCreated: 1477036743
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 49 - 0
Assets/NavMeshComponents/Editor/NavMeshModifierEditor.cs

@@ -0,0 +1,49 @@
+using UnityEngine.AI;
+
+namespace UnityEditor.AI
+{
+    [CanEditMultipleObjects]
+    [CustomEditor(typeof(NavMeshModifier))]
+    class NavMeshModifierEditor : Editor
+    {
+        SerializedProperty m_AffectedAgents;
+        SerializedProperty m_Area;
+        SerializedProperty m_IgnoreFromBuild;
+        SerializedProperty m_OverrideArea;
+
+        void OnEnable()
+        {
+            m_AffectedAgents = serializedObject.FindProperty("m_AffectedAgents");
+            m_Area = serializedObject.FindProperty("m_Area");
+            m_IgnoreFromBuild = serializedObject.FindProperty("m_IgnoreFromBuild");
+            m_OverrideArea = serializedObject.FindProperty("m_OverrideArea");
+
+            NavMeshVisualizationSettings.showNavigation++;
+        }
+
+        void OnDisable()
+        {
+            NavMeshVisualizationSettings.showNavigation--;
+        }
+
+        public override void OnInspectorGUI()
+        {
+            serializedObject.Update();
+
+            EditorGUILayout.PropertyField(m_IgnoreFromBuild);
+
+            EditorGUILayout.PropertyField(m_OverrideArea);
+            if (m_OverrideArea.boolValue)
+            {
+                EditorGUI.indentLevel++;
+                NavMeshComponentsGUIUtility.AreaPopup("Area Type", m_Area);
+                EditorGUI.indentLevel--;
+            }
+
+            NavMeshComponentsGUIUtility.AgentMaskPopup("Affected Agents", m_AffectedAgents);
+            EditorGUILayout.Space();
+
+            serializedObject.ApplyModifiedProperties();
+        }
+    }
+}

+ 12 - 0
Assets/NavMeshComponents/Editor/NavMeshModifierEditor.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6fa04b4743e3947eba4d7b9e5832ea69
+timeCreated: 1477036742
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 146 - 0
Assets/NavMeshComponents/Editor/NavMeshModifierVolumeEditor.cs

@@ -0,0 +1,146 @@
+using UnityEditor.IMGUI.Controls;
+using UnityEditorInternal;
+using UnityEngine.AI;
+using UnityEngine;
+
+namespace UnityEditor.AI
+{
+    [CanEditMultipleObjects]
+    [CustomEditor(typeof(NavMeshModifierVolume))]
+    class NavMeshModifierVolumeEditor : Editor
+    {
+        SerializedProperty m_AffectedAgents;
+        SerializedProperty m_Area;
+        SerializedProperty m_Center;
+        SerializedProperty m_Size;
+
+        static Color s_HandleColor = new Color(187f, 138f, 240f, 210f) / 255;
+        static Color s_HandleColorDisabled = new Color(187f * 0.75f, 138f * 0.75f, 240f * 0.75f, 100f) / 255;
+
+        BoxBoundsHandle m_BoundsHandle = new BoxBoundsHandle();
+
+        bool editingCollider
+        {
+            get { return EditMode.editMode == EditMode.SceneViewEditMode.Collider && EditMode.IsOwner(this); }
+        }
+
+        void OnEnable()
+        {
+            m_AffectedAgents = serializedObject.FindProperty("m_AffectedAgents");
+            m_Area = serializedObject.FindProperty("m_Area");
+            m_Center = serializedObject.FindProperty("m_Center");
+            m_Size = serializedObject.FindProperty("m_Size");
+
+            NavMeshVisualizationSettings.showNavigation++;
+        }
+
+        void OnDisable()
+        {
+            NavMeshVisualizationSettings.showNavigation--;
+        }
+
+        Bounds GetBounds()
+        {
+            var navModifier = (NavMeshModifierVolume)target;
+            return new Bounds(navModifier.transform.position, navModifier.size);
+        }
+
+        public override void OnInspectorGUI()
+        {
+            serializedObject.Update();
+
+            EditMode.DoEditModeInspectorModeButton(EditMode.SceneViewEditMode.Collider, "Edit Volume",
+                EditorGUIUtility.IconContent("EditCollider"), GetBounds, this);
+
+            EditorGUILayout.PropertyField(m_Size);
+            EditorGUILayout.PropertyField(m_Center);
+
+            NavMeshComponentsGUIUtility.AreaPopup("Area Type", m_Area);
+            NavMeshComponentsGUIUtility.AgentMaskPopup("Affected Agents", m_AffectedAgents);
+            EditorGUILayout.Space();
+
+            serializedObject.ApplyModifiedProperties();
+        }
+
+        [DrawGizmo(GizmoType.Selected | GizmoType.Active)]
+        static void RenderBoxGizmo(NavMeshModifierVolume navModifier, GizmoType gizmoType)
+        {
+            var color = navModifier.enabled ? s_HandleColor : s_HandleColorDisabled;
+            var colorTrans = new Color(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, color.a * 0.15f);
+
+            var oldColor = Gizmos.color;
+            var oldMatrix = Gizmos.matrix;
+
+            Gizmos.matrix = navModifier.transform.localToWorldMatrix;
+
+            Gizmos.color = colorTrans;
+            Gizmos.DrawCube(navModifier.center, navModifier.size);
+
+            Gizmos.color = color;
+            Gizmos.DrawWireCube(navModifier.center, navModifier.size);
+
+            Gizmos.matrix = oldMatrix;
+            Gizmos.color = oldColor;
+
+            Gizmos.DrawIcon(navModifier.transform.position, "NavMeshModifierVolume Icon", true);
+        }
+
+        [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)]
+        static void RenderBoxGizmoNotSelected(NavMeshModifierVolume navModifier, GizmoType gizmoType)
+        {
+            if (NavMeshVisualizationSettings.showNavigation > 0)
+            {
+                var color = navModifier.enabled ? s_HandleColor : s_HandleColorDisabled;
+                var oldColor = Gizmos.color;
+                var oldMatrix = Gizmos.matrix;
+
+                Gizmos.matrix = navModifier.transform.localToWorldMatrix;
+
+                Gizmos.color = color;
+                Gizmos.DrawWireCube(navModifier.center, navModifier.size);
+
+                Gizmos.matrix = oldMatrix;
+                Gizmos.color = oldColor;
+            }
+
+            Gizmos.DrawIcon(navModifier.transform.position, "NavMeshModifierVolume Icon", true);
+        }
+
+        void OnSceneGUI()
+        {
+            if (!editingCollider)
+                return;
+
+            var vol = (NavMeshModifierVolume)target;
+            var color = vol.enabled ? s_HandleColor : s_HandleColorDisabled;
+            using (new Handles.DrawingScope(color, vol.transform.localToWorldMatrix))
+            {
+                m_BoundsHandle.center = vol.center;
+                m_BoundsHandle.size = vol.size;
+
+                EditorGUI.BeginChangeCheck();
+                m_BoundsHandle.DrawHandle();
+                if (EditorGUI.EndChangeCheck())
+                {
+                    Undo.RecordObject(vol, "Modified NavMesh Modifier Volume");
+                    Vector3 center = m_BoundsHandle.center;
+                    Vector3 size = m_BoundsHandle.size;
+                    vol.center = center;
+                    vol.size = size;
+                    EditorUtility.SetDirty(target);
+                }
+            }
+        }
+
+        [MenuItem("GameObject/AI/NavMesh Modifier Volume", false, 2001)]
+        static public void CreateNavMeshModifierVolume(MenuCommand menuCommand)
+        {
+            var parent = menuCommand.context as GameObject;
+            var go = NavMeshComponentsGUIUtility.CreateAndSelectGameObject("NavMesh Modifier Volume", parent);
+            go.AddComponent<NavMeshModifierVolume>();
+            var view = SceneView.lastActiveSceneView;
+            if (view != null)
+                view.MoveToView(go.transform);
+        }
+    }
+}

+ 12 - 0
Assets/NavMeshComponents/Editor/NavMeshModifierVolumeEditor.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c0f3bef2a67ae4e139538afec3e59b03
+timeCreated: 1477036743
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 400 - 0
Assets/NavMeshComponents/Editor/NavMeshSurfaceEditor.cs

@@ -0,0 +1,400 @@
+#define NAVMESHCOMPONENTS_SHOW_NAVMESHDATA_REF
+
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using UnityEditor.Experimental.SceneManagement;
+using UnityEditor.IMGUI.Controls;
+using UnityEditor.SceneManagement;
+using UnityEditorInternal;
+using UnityEngine.AI;
+using UnityEngine;
+
+namespace UnityEditor.AI
+{
+    [CanEditMultipleObjects]
+    [CustomEditor(typeof(NavMeshSurface))]
+    class NavMeshSurfaceEditor : Editor
+    {
+        SerializedProperty m_AgentTypeID;
+        SerializedProperty m_BuildHeightMesh;
+        SerializedProperty m_Center;
+        SerializedProperty m_CollectObjects;
+        SerializedProperty m_DefaultArea;
+        SerializedProperty m_LayerMask;
+        SerializedProperty m_OverrideTileSize;
+        SerializedProperty m_OverrideVoxelSize;
+        SerializedProperty m_Size;
+        SerializedProperty m_TileSize;
+        SerializedProperty m_UseGeometry;
+        SerializedProperty m_VoxelSize;
+
+#if NAVMESHCOMPONENTS_SHOW_NAVMESHDATA_REF
+        SerializedProperty m_NavMeshData;
+#endif
+        class Styles
+        {
+            public readonly GUIContent m_LayerMask = new GUIContent("Include Layers");
+
+            public readonly GUIContent m_ShowInputGeom = new GUIContent("Show Input Geom");
+            public readonly GUIContent m_ShowVoxels = new GUIContent("Show Voxels");
+            public readonly GUIContent m_ShowRegions = new GUIContent("Show Regions");
+            public readonly GUIContent m_ShowRawContours = new GUIContent("Show Raw Contours");
+            public readonly GUIContent m_ShowContours = new GUIContent("Show Contours");
+            public readonly GUIContent m_ShowPolyMesh = new GUIContent("Show Poly Mesh");
+            public readonly GUIContent m_ShowPolyMeshDetail = new GUIContent("Show Poly Mesh Detail");
+        }
+
+        static Styles s_Styles;
+
+        static bool s_ShowDebugOptions;
+
+        static Color s_HandleColor = new Color(127f, 214f, 244f, 100f) / 255;
+        static Color s_HandleColorSelected = new Color(127f, 214f, 244f, 210f) / 255;
+        static Color s_HandleColorDisabled = new Color(127f * 0.75f, 214f * 0.75f, 244f * 0.75f, 100f) / 255;
+
+        BoxBoundsHandle m_BoundsHandle = new BoxBoundsHandle();
+
+        bool editingCollider
+        {
+            get { return EditMode.editMode == EditMode.SceneViewEditMode.Collider && EditMode.IsOwner(this); }
+        }
+
+        void OnEnable()
+        {
+            m_AgentTypeID = serializedObject.FindProperty("m_AgentTypeID");
+            m_BuildHeightMesh = serializedObject.FindProperty("m_BuildHeightMesh");
+            m_Center = serializedObject.FindProperty("m_Center");
+            m_CollectObjects = serializedObject.FindProperty("m_CollectObjects");
+            m_DefaultArea = serializedObject.FindProperty("m_DefaultArea");
+            m_LayerMask = serializedObject.FindProperty("m_LayerMask");
+            m_OverrideTileSize = serializedObject.FindProperty("m_OverrideTileSize");
+            m_OverrideVoxelSize = serializedObject.FindProperty("m_OverrideVoxelSize");
+            m_Size = serializedObject.FindProperty("m_Size");
+            m_TileSize = serializedObject.FindProperty("m_TileSize");
+            m_UseGeometry = serializedObject.FindProperty("m_UseGeometry");
+            m_VoxelSize = serializedObject.FindProperty("m_VoxelSize");
+
+#if NAVMESHCOMPONENTS_SHOW_NAVMESHDATA_REF
+            m_NavMeshData = serializedObject.FindProperty("m_NavMeshData");
+#endif
+            NavMeshVisualizationSettings.showNavigation++;
+        }
+
+        void OnDisable()
+        {
+            NavMeshVisualizationSettings.showNavigation--;
+        }
+
+        Bounds GetBounds()
+        {
+            var navSurface = (NavMeshSurface)target;
+            return new Bounds(navSurface.transform.position, navSurface.size);
+        }
+
+        public override void OnInspectorGUI()
+        {
+            if (s_Styles == null)
+                s_Styles = new Styles();
+
+            serializedObject.Update();
+
+            var bs = NavMesh.GetSettingsByID(m_AgentTypeID.intValue);
+
+            if (bs.agentTypeID != -1)
+            {
+                // Draw image
+                const float diagramHeight = 80.0f;
+                Rect agentDiagramRect = EditorGUILayout.GetControlRect(false, diagramHeight);
+                NavMeshEditorHelpers.DrawAgentDiagram(agentDiagramRect, bs.agentRadius, bs.agentHeight, bs.agentClimb, bs.agentSlope);
+            }
+            NavMeshComponentsGUIUtility.AgentTypePopup("Agent Type", m_AgentTypeID);
+
+            EditorGUILayout.Space();
+
+            EditorGUILayout.PropertyField(m_CollectObjects);
+            if ((CollectObjects)m_CollectObjects.enumValueIndex == CollectObjects.Volume)
+            {
+                EditorGUI.indentLevel++;
+
+                EditMode.DoEditModeInspectorModeButton(EditMode.SceneViewEditMode.Collider, "Edit Volume",
+                    EditorGUIUtility.IconContent("EditCollider"), GetBounds, this);
+                EditorGUILayout.PropertyField(m_Size);
+                EditorGUILayout.PropertyField(m_Center);
+
+                EditorGUI.indentLevel--;
+            }
+            else
+            {
+                if (editingCollider)
+                    EditMode.QuitEditMode();
+            }
+
+            EditorGUILayout.PropertyField(m_LayerMask, s_Styles.m_LayerMask);
+            EditorGUILayout.PropertyField(m_UseGeometry);
+
+            EditorGUILayout.Space();
+
+            m_OverrideVoxelSize.isExpanded = EditorGUILayout.Foldout(m_OverrideVoxelSize.isExpanded, "Advanced");
+            if (m_OverrideVoxelSize.isExpanded)
+            {
+                EditorGUI.indentLevel++;
+
+                NavMeshComponentsGUIUtility.AreaPopup("Default Area", m_DefaultArea);
+
+                // Override voxel size.
+                EditorGUILayout.PropertyField(m_OverrideVoxelSize);
+
+                using (new EditorGUI.DisabledScope(!m_OverrideVoxelSize.boolValue || m_OverrideVoxelSize.hasMultipleDifferentValues))
+                {
+                    EditorGUI.indentLevel++;
+
+                    EditorGUILayout.PropertyField(m_VoxelSize);
+
+                    if (!m_OverrideVoxelSize.hasMultipleDifferentValues)
+                    {
+                        if (!m_AgentTypeID.hasMultipleDifferentValues)
+                        {
+                            float voxelsPerRadius = m_VoxelSize.floatValue > 0.0f ? (bs.agentRadius / m_VoxelSize.floatValue) : 0.0f;
+                            EditorGUILayout.LabelField(" ", voxelsPerRadius.ToString("0.00") + " voxels per agent radius", EditorStyles.miniLabel);
+                        }
+                        if (m_OverrideVoxelSize.boolValue)
+                            EditorGUILayout.HelpBox("Voxel size controls how accurately the navigation mesh is generated from the level geometry. A good voxel size is 2-4 voxels per agent radius. Making voxel size smaller will increase build time.", MessageType.None);
+                    }
+                    EditorGUI.indentLevel--;
+                }
+
+                // Override tile size
+                EditorGUILayout.PropertyField(m_OverrideTileSize);
+
+                using (new EditorGUI.DisabledScope(!m_OverrideTileSize.boolValue || m_OverrideTileSize.hasMultipleDifferentValues))
+                {
+                    EditorGUI.indentLevel++;
+
+                    EditorGUILayout.PropertyField(m_TileSize);
+
+                    if (!m_TileSize.hasMultipleDifferentValues && !m_VoxelSize.hasMultipleDifferentValues)
+                    {
+                        float tileWorldSize = m_TileSize.intValue * m_VoxelSize.floatValue;
+                        EditorGUILayout.LabelField(" ", tileWorldSize.ToString("0.00") + " world units", EditorStyles.miniLabel);
+                    }
+
+                    if (!m_OverrideTileSize.hasMultipleDifferentValues)
+                    {
+                        if (m_OverrideTileSize.boolValue)
+                            EditorGUILayout.HelpBox("Tile size controls the how local the changes to the world are (rebuild or carve). Small tile size allows more local changes, while potentially generating more data overall.", MessageType.None);
+                    }
+                    EditorGUI.indentLevel--;
+                }
+
+
+                // Height mesh
+                using (new EditorGUI.DisabledScope(true))
+                {
+                    EditorGUILayout.PropertyField(m_BuildHeightMesh);
+                }
+
+                EditorGUILayout.Space();
+                EditorGUI.indentLevel--;
+            }
+
+            EditorGUILayout.Space();
+
+            serializedObject.ApplyModifiedProperties();
+
+            var hadError = false;
+            var multipleTargets = targets.Length > 1;
+            foreach (NavMeshSurface navSurface in targets)
+            {
+                var settings = navSurface.GetBuildSettings();
+                // Calculating bounds is potentially expensive when unbounded - so here we just use the center/size.
+                // It means the validation is not checking vertical voxel limit correctly when the surface is set to something else than "in volume".
+                var bounds = new Bounds(Vector3.zero, Vector3.zero);
+                if (navSurface.collectObjects == CollectObjects.Volume)
+                {
+                    bounds = new Bounds(navSurface.center, navSurface.size);
+                }
+
+                var errors = settings.ValidationReport(bounds);
+                if (errors.Length > 0)
+                {
+                    if (multipleTargets)
+                        EditorGUILayout.LabelField(navSurface.name);
+                    foreach (var err in errors)
+                    {
+                        EditorGUILayout.HelpBox(err, MessageType.Warning);
+                    }
+                    GUILayout.BeginHorizontal();
+                    GUILayout.Space(EditorGUIUtility.labelWidth);
+                    if (GUILayout.Button("Open Agent Settings...", EditorStyles.miniButton))
+                        NavMeshEditorHelpers.OpenAgentSettings(navSurface.agentTypeID);
+                    GUILayout.EndHorizontal();
+                    hadError = true;
+                }
+            }
+
+            if (hadError)
+                EditorGUILayout.Space();
+
+#if NAVMESHCOMPONENTS_SHOW_NAVMESHDATA_REF
+            var nmdRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);
+
+            EditorGUI.BeginProperty(nmdRect, GUIContent.none, m_NavMeshData);
+            var rectLabel = EditorGUI.PrefixLabel(nmdRect, GUIUtility.GetControlID(FocusType.Passive), new GUIContent(m_NavMeshData.displayName));
+            EditorGUI.EndProperty();
+
+            using (new EditorGUI.DisabledScope(true))
+            {
+                EditorGUI.BeginProperty(nmdRect, GUIContent.none, m_NavMeshData);
+                EditorGUI.ObjectField(rectLabel, m_NavMeshData, GUIContent.none);
+                EditorGUI.EndProperty();
+            }
+#endif
+            using (new EditorGUI.DisabledScope(Application.isPlaying || m_AgentTypeID.intValue == -1))
+            {
+                GUILayout.BeginHorizontal();
+                GUILayout.Space(EditorGUIUtility.labelWidth);
+                if (GUILayout.Button("Clear"))
+                {
+                    NavMeshAssetManager.instance.ClearSurfaces(targets);
+                    SceneView.RepaintAll();
+                }
+
+                if (GUILayout.Button("Bake"))
+                {
+                    NavMeshAssetManager.instance.StartBakingSurfaces(targets);
+                }
+
+                GUILayout.EndHorizontal();
+            }
+
+            // Show progress for the selected targets
+            var bakeOperations = NavMeshAssetManager.instance.GetBakeOperations();
+            for (int i = bakeOperations.Count - 1; i >= 0; --i)
+            {
+                if (!targets.Contains(bakeOperations[i].surface))
+                    continue;
+
+                var oper = bakeOperations[i].bakeOperation;
+                if (oper == null)
+                    continue;
+
+                var p = oper.progress;
+                if (oper.isDone)
+                {
+                    SceneView.RepaintAll();
+                    continue;
+                }
+
+                GUILayout.BeginHorizontal();
+
+                if (GUILayout.Button("Cancel", EditorStyles.miniButton))
+                {
+                    var bakeData = bakeOperations[i].bakeData;
+                    UnityEngine.AI.NavMeshBuilder.Cancel(bakeData);
+                    bakeOperations.RemoveAt(i);
+                }
+
+                EditorGUI.ProgressBar(EditorGUILayout.GetControlRect(), p, "Baking: " + (int)(100 * p) + "%");
+                if (p <= 1)
+                    Repaint();
+
+                GUILayout.EndHorizontal();
+            }
+        }
+
+        [DrawGizmo(GizmoType.Selected | GizmoType.Active | GizmoType.Pickable)]
+        static void RenderBoxGizmoSelected(NavMeshSurface navSurface, GizmoType gizmoType)
+        {
+            RenderBoxGizmo(navSurface, gizmoType, true);
+        }
+
+        [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)]
+        static void RenderBoxGizmoNotSelected(NavMeshSurface navSurface, GizmoType gizmoType)
+        {
+            if (NavMeshVisualizationSettings.showNavigation > 0)
+                RenderBoxGizmo(navSurface, gizmoType, false);
+            else
+                Gizmos.DrawIcon(navSurface.transform.position, "NavMeshSurface Icon", true);
+        }
+
+        static void RenderBoxGizmo(NavMeshSurface navSurface, GizmoType gizmoType, bool selected)
+        {
+            var color = selected ? s_HandleColorSelected : s_HandleColor;
+            if (!navSurface.enabled)
+                color = s_HandleColorDisabled;
+
+            var oldColor = Gizmos.color;
+            var oldMatrix = Gizmos.matrix;
+
+            // Use the unscaled matrix for the NavMeshSurface
+            var localToWorld = Matrix4x4.TRS(navSurface.transform.position, navSurface.transform.rotation, Vector3.one);
+            Gizmos.matrix = localToWorld;
+
+            if (navSurface.collectObjects == CollectObjects.Volume)
+            {
+                Gizmos.color = color;
+                Gizmos.DrawWireCube(navSurface.center, navSurface.size);
+
+                if (selected && navSurface.enabled)
+                {
+                    var colorTrans = new Color(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, color.a * 0.15f);
+                    Gizmos.color = colorTrans;
+                    Gizmos.DrawCube(navSurface.center, navSurface.size);
+                }
+            }
+            else
+            {
+                if (navSurface.navMeshData != null)
+                {
+                    var bounds = navSurface.navMeshData.sourceBounds;
+                    Gizmos.color = Color.grey;
+                    Gizmos.DrawWireCube(bounds.center, bounds.size);
+                }
+            }
+
+            Gizmos.matrix = oldMatrix;
+            Gizmos.color = oldColor;
+
+            Gizmos.DrawIcon(navSurface.transform.position, "NavMeshSurface Icon", true);
+        }
+
+        void OnSceneGUI()
+        {
+            if (!editingCollider)
+                return;
+
+            var navSurface = (NavMeshSurface)target;
+            var color = navSurface.enabled ? s_HandleColor : s_HandleColorDisabled;
+            var localToWorld = Matrix4x4.TRS(navSurface.transform.position, navSurface.transform.rotation, Vector3.one);
+            using (new Handles.DrawingScope(color, localToWorld))
+            {
+                m_BoundsHandle.center = navSurface.center;
+                m_BoundsHandle.size = navSurface.size;
+
+                EditorGUI.BeginChangeCheck();
+                m_BoundsHandle.DrawHandle();
+                if (EditorGUI.EndChangeCheck())
+                {
+                    Undo.RecordObject(navSurface, "Modified NavMesh Surface");
+                    Vector3 center = m_BoundsHandle.center;
+                    Vector3 size = m_BoundsHandle.size;
+                    navSurface.center = center;
+                    navSurface.size = size;
+                    EditorUtility.SetDirty(target);
+                }
+            }
+        }
+
+        [MenuItem("GameObject/AI/NavMesh Surface", false, 2000)]
+        public static void CreateNavMeshSurface(MenuCommand menuCommand)
+        {
+            var parent = menuCommand.context as GameObject;
+            var go = NavMeshComponentsGUIUtility.CreateAndSelectGameObject("NavMesh Surface", parent);
+            go.AddComponent<NavMeshSurface>();
+            var view = SceneView.lastActiveSceneView;
+            if (view != null)
+                view.MoveToView(go.transform);
+        }
+    }
+}

+ 12 - 0
Assets/NavMeshComponents/Editor/NavMeshSurfaceEditor.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 1c32167dbf3314852b6006a288eb449b
+timeCreated: 1476968447
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/NavMeshComponents/Scripts.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ce67aa87f613246dda63a54a59c6399e
+folderAsset: yes
+timeCreated: 1477656493
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 12 - 0
Assets/NavMeshComponents/Scripts/NavMeshComponents.asmdef

@@ -0,0 +1,12 @@
+{
+    "name": "NavMeshComponents",
+    "references": [],
+    "optionalUnityReferences": [],
+    "includePlatforms": [],
+    "excludePlatforms": [],
+    "allowUnsafeCode": false,
+    "overrideReferences": false,
+    "precompiledReferences": [],
+    "autoReferenced": true,
+    "defineConstraints": []
+}

+ 7 - 0
Assets/NavMeshComponents/Scripts/NavMeshComponents.asmdef.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 8c4dd21966739024fbd72155091d199e
+AssemblyDefinitionImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 172 - 0
Assets/NavMeshComponents/Scripts/NavMeshLink.cs

@@ -0,0 +1,172 @@
+using System.Collections.Generic;
+
+namespace UnityEngine.AI
+{
+    [ExecuteInEditMode]
+    [DefaultExecutionOrder(-101)]
+    [AddComponentMenu("Navigation/NavMeshLink", 33)]
+    [HelpURL("https://github.com/Unity-Technologies/NavMeshComponents#documentation-draft")]
+    public class NavMeshLink : MonoBehaviour
+    {
+        [SerializeField]
+        int m_AgentTypeID;
+        public int agentTypeID { get { return m_AgentTypeID; } set { m_AgentTypeID = value; UpdateLink(); } }
+
+        [SerializeField]
+        Vector3 m_StartPoint = new Vector3(0.0f, 0.0f, -2.5f);
+        public Vector3 startPoint { get { return m_StartPoint; } set { m_StartPoint = value; UpdateLink(); } }
+
+        [SerializeField]
+        Vector3 m_EndPoint = new Vector3(0.0f, 0.0f, 2.5f);
+        public Vector3 endPoint { get { return m_EndPoint; } set { m_EndPoint = value; UpdateLink(); } }
+
+        [SerializeField]
+        float m_Width;
+        public float width { get { return m_Width; } set { m_Width = value; UpdateLink(); } }
+
+        [SerializeField]
+        int m_CostModifier = -1;
+        public int costModifier { get { return m_CostModifier; } set { m_CostModifier = value; UpdateLink(); } }
+
+        [SerializeField]
+        bool m_Bidirectional = true;
+        public bool bidirectional { get { return m_Bidirectional; } set { m_Bidirectional = value; UpdateLink(); } }
+
+        [SerializeField]
+        bool m_AutoUpdatePosition;
+        public bool autoUpdate { get { return m_AutoUpdatePosition; } set { SetAutoUpdate(value); } }
+
+        [SerializeField]
+        int m_Area;
+        public int area { get { return m_Area; } set { m_Area = value; UpdateLink(); } }
+
+        NavMeshLinkInstance m_LinkInstance = new NavMeshLinkInstance();
+
+        Vector3 m_LastPosition = Vector3.zero;
+        Quaternion m_LastRotation = Quaternion.identity;
+
+        static readonly List<NavMeshLink> s_Tracked = new List<NavMeshLink>();
+
+        void OnEnable()
+        {
+            AddLink();
+            if (m_AutoUpdatePosition && m_LinkInstance.valid)
+                AddTracking(this);
+        }
+
+        void OnDisable()
+        {
+            RemoveTracking(this);
+            m_LinkInstance.Remove();
+        }
+
+        public void UpdateLink()
+        {
+            m_LinkInstance.Remove();
+            AddLink();
+        }
+
+        static void AddTracking(NavMeshLink link)
+        {
+#if UNITY_EDITOR
+            if (s_Tracked.Contains(link))
+            {
+                Debug.LogError("Link is already tracked: " + link);
+                return;
+            }
+#endif
+
+            if (s_Tracked.Count == 0)
+                NavMesh.onPreUpdate += UpdateTrackedInstances;
+
+            s_Tracked.Add(link);
+        }
+
+        static void RemoveTracking(NavMeshLink link)
+        {
+            s_Tracked.Remove(link);
+
+            if (s_Tracked.Count == 0)
+                NavMesh.onPreUpdate -= UpdateTrackedInstances;
+        }
+
+        void SetAutoUpdate(bool value)
+        {
+            if (m_AutoUpdatePosition == value)
+                return;
+            m_AutoUpdatePosition = value;
+            if (value)
+                AddTracking(this);
+            else
+                RemoveTracking(this);
+        }
+
+        void AddLink()
+        {
+#if UNITY_EDITOR
+            if (m_LinkInstance.valid)
+            {
+                Debug.LogError("Link is already added: " + this);
+                return;
+            }
+#endif
+
+            var link = new NavMeshLinkData();
+            link.startPosition = m_StartPoint;
+            link.endPosition = m_EndPoint;
+            link.width = m_Width;
+            link.costModifier = m_CostModifier;
+            link.bidirectional = m_Bidirectional;
+            link.area = m_Area;
+            link.agentTypeID = m_AgentTypeID;
+            m_LinkInstance = NavMesh.AddLink(link, transform.position, transform.rotation);
+            if (m_LinkInstance.valid)
+                m_LinkInstance.owner = this;
+
+            m_LastPosition = transform.position;
+            m_LastRotation = transform.rotation;
+        }
+
+        bool HasTransformChanged()
+        {
+            if (m_LastPosition != transform.position) return true;
+            if (m_LastRotation != transform.rotation) return true;
+            return false;
+        }
+
+        void OnDidApplyAnimationProperties()
+        {
+            UpdateLink();
+        }
+
+        static void UpdateTrackedInstances()
+        {
+            foreach (var instance in s_Tracked)
+            {
+                if (instance.HasTransformChanged())
+                    instance.UpdateLink();
+            }
+        }
+
+#if UNITY_EDITOR
+        void OnValidate()
+        {
+            m_Width = Mathf.Max(0.0f, m_Width);
+
+            if (!m_LinkInstance.valid)
+                return;
+
+            UpdateLink();
+
+            if (!m_AutoUpdatePosition)
+            {
+                RemoveTracking(this);
+            }
+            else if (!s_Tracked.Contains(this))
+            {
+                AddTracking(this);
+            }
+        }
+#endif
+    }
+}

+ 12 - 0
Assets/NavMeshComponents/Scripts/NavMeshLink.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6eeb5dc026fdf4b488bc7ae0138ab719
+timeCreated: 1477924439
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {fileID: 2800000, guid: 92f4afa3e25264f5b964937ccea49ff2, type: 3}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 54 - 0
Assets/NavMeshComponents/Scripts/NavMeshModifier.cs

@@ -0,0 +1,54 @@
+using System.Collections.Generic;
+
+namespace UnityEngine.AI
+{
+    [ExecuteInEditMode]
+    [AddComponentMenu("Navigation/NavMeshModifier", 32)]
+    [HelpURL("https://github.com/Unity-Technologies/NavMeshComponents#documentation-draft")]
+    public class NavMeshModifier : MonoBehaviour
+    {
+        [SerializeField]
+        bool m_OverrideArea;
+        public bool overrideArea { get { return m_OverrideArea; } set { m_OverrideArea = value; } }
+
+        [SerializeField]
+        int m_Area;
+        public int area { get { return m_Area; } set { m_Area = value; } }
+
+        [SerializeField]
+        bool m_IgnoreFromBuild;
+        public bool ignoreFromBuild { get { return m_IgnoreFromBuild; } set { m_IgnoreFromBuild = value; } }
+
+        // List of agent types the modifier is applied for.
+        // Special values: empty == None, m_AffectedAgents[0] =-1 == All.
+        [SerializeField]
+        List<int> m_AffectedAgents = new List<int>(new int[] { -1 });    // Default value is All
+
+        static readonly List<NavMeshModifier> s_NavMeshModifiers = new List<NavMeshModifier>();
+
+        public static List<NavMeshModifier> activeModifiers
+        {
+            get { return s_NavMeshModifiers; }
+        }
+
+        void OnEnable()
+        {
+            if (!s_NavMeshModifiers.Contains(this))
+                s_NavMeshModifiers.Add(this);
+        }
+
+        void OnDisable()
+        {
+            s_NavMeshModifiers.Remove(this);
+        }
+
+        public bool AffectsAgentType(int agentTypeID)
+        {
+            if (m_AffectedAgents.Count == 0)
+                return false;
+            if (m_AffectedAgents[0] == -1)
+                return true;
+            return m_AffectedAgents.IndexOf(agentTypeID) != -1;
+        }
+    }
+}

+ 12 - 0
Assets/NavMeshComponents/Scripts/NavMeshModifier.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 1e3fdca004f2d45fe8abbed571a8abd5
+timeCreated: 1477924411
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {fileID: 2800000, guid: cc7b9475dbddf4f9088d327d6e10ab77, type: 3}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 54 - 0
Assets/NavMeshComponents/Scripts/NavMeshModifierVolume.cs

@@ -0,0 +1,54 @@
+using System.Collections.Generic;
+
+namespace UnityEngine.AI
+{
+    [ExecuteInEditMode]
+    [AddComponentMenu("Navigation/NavMeshModifierVolume", 31)]
+    [HelpURL("https://github.com/Unity-Technologies/NavMeshComponents#documentation-draft")]
+    public class NavMeshModifierVolume : MonoBehaviour
+    {
+        [SerializeField]
+        Vector3 m_Size = new Vector3(4.0f, 3.0f, 4.0f);
+        public Vector3 size { get { return m_Size; } set { m_Size = value; } }
+
+        [SerializeField]
+        Vector3 m_Center = new Vector3(0, 1.0f, 0);
+        public Vector3 center { get { return m_Center; } set { m_Center = value; } }
+
+        [SerializeField]
+        int m_Area;
+        public int area { get { return m_Area; } set { m_Area = value; } }
+
+        // List of agent types the modifier is applied for.
+        // Special values: empty == None, m_AffectedAgents[0] =-1 == All.
+        [SerializeField]
+        List<int> m_AffectedAgents = new List<int>(new int[] { -1 });    // Default value is All
+
+        static readonly List<NavMeshModifierVolume> s_NavMeshModifiers = new List<NavMeshModifierVolume>();
+
+        public static List<NavMeshModifierVolume> activeModifiers
+        {
+            get { return s_NavMeshModifiers; }
+        }
+
+        void OnEnable()
+        {
+            if (!s_NavMeshModifiers.Contains(this))
+                s_NavMeshModifiers.Add(this);
+        }
+
+        void OnDisable()
+        {
+            s_NavMeshModifiers.Remove(this);
+        }
+
+        public bool AffectsAgentType(int agentTypeID)
+        {
+            if (m_AffectedAgents.Count == 0)
+                return false;
+            if (m_AffectedAgents[0] == -1)
+                return true;
+            return m_AffectedAgents.IndexOf(agentTypeID) != -1;
+        }
+    }
+}

+ 12 - 0
Assets/NavMeshComponents/Scripts/NavMeshModifierVolume.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 35e95dc5ff2b64380880dd7ac5922847
+timeCreated: 1477924430
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {fileID: 2800000, guid: cc7b9475dbddf4f9088d327d6e10ab77, type: 3}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 486 - 0
Assets/NavMeshComponents/Scripts/NavMeshSurface.cs

@@ -0,0 +1,486 @@
+using System.Collections.Generic;
+#if UNITY_EDITOR
+using UnityEditor;
+using UnityEditor.SceneManagement;
+#endif
+
+namespace UnityEngine.AI
+{
+    public enum CollectObjects
+    {
+        All = 0,
+        Volume = 1,
+        Children = 2,
+    }
+
+    [ExecuteAlways]
+    [DefaultExecutionOrder(-102)]
+    [AddComponentMenu("Navigation/NavMeshSurface", 30)]
+    [HelpURL("https://github.com/Unity-Technologies/NavMeshComponents#documentation-draft")]
+    public class NavMeshSurface : MonoBehaviour
+    {
+        [SerializeField]
+        int m_AgentTypeID;
+        public int agentTypeID { get { return m_AgentTypeID; } set { m_AgentTypeID = value; } }
+
+        [SerializeField]
+        CollectObjects m_CollectObjects = CollectObjects.All;
+        public CollectObjects collectObjects { get { return m_CollectObjects; } set { m_CollectObjects = value; } }
+
+        [SerializeField]
+        Vector3 m_Size = new Vector3(10.0f, 10.0f, 10.0f);
+        public Vector3 size { get { return m_Size; } set { m_Size = value; } }
+
+        [SerializeField]
+        Vector3 m_Center = new Vector3(0, 2.0f, 0);
+        public Vector3 center { get { return m_Center; } set { m_Center = value; } }
+
+        [SerializeField]
+        LayerMask m_LayerMask = ~0;
+        public LayerMask layerMask { get { return m_LayerMask; } set { m_LayerMask = value; } }
+
+        [SerializeField]
+        NavMeshCollectGeometry m_UseGeometry = NavMeshCollectGeometry.RenderMeshes;
+        public NavMeshCollectGeometry useGeometry { get { return m_UseGeometry; } set { m_UseGeometry = value; } }
+
+        [SerializeField]
+        int m_DefaultArea;
+        public int defaultArea { get { return m_DefaultArea; } set { m_DefaultArea = value; } }
+
+        [SerializeField]
+        bool m_IgnoreNavMeshAgent = true;
+        public bool ignoreNavMeshAgent { get { return m_IgnoreNavMeshAgent; } set { m_IgnoreNavMeshAgent = value; } }
+
+        [SerializeField]
+        bool m_IgnoreNavMeshObstacle = true;
+        public bool ignoreNavMeshObstacle { get { return m_IgnoreNavMeshObstacle; } set { m_IgnoreNavMeshObstacle = value; } }
+
+        [SerializeField]
+        bool m_OverrideTileSize;
+        public bool overrideTileSize { get { return m_OverrideTileSize; } set { m_OverrideTileSize = value; } }
+        [SerializeField]
+        int m_TileSize = 256;
+        public int tileSize { get { return m_TileSize; } set { m_TileSize = value; } }
+        [SerializeField]
+        bool m_OverrideVoxelSize;
+        public bool overrideVoxelSize { get { return m_OverrideVoxelSize; } set { m_OverrideVoxelSize = value; } }
+        [SerializeField]
+        float m_VoxelSize;
+        public float voxelSize { get { return m_VoxelSize; } set { m_VoxelSize = value; } }
+
+        // Currently not supported advanced options
+        [SerializeField]
+        bool m_BuildHeightMesh;
+        public bool buildHeightMesh { get { return m_BuildHeightMesh; } set { m_BuildHeightMesh = value; } }
+
+        // Reference to whole scene navmesh data asset.
+        [UnityEngine.Serialization.FormerlySerializedAs("m_BakedNavMeshData")]
+        [SerializeField]
+        NavMeshData m_NavMeshData;
+        public NavMeshData navMeshData { get { return m_NavMeshData; } set { m_NavMeshData = value; } }
+
+        // Do not serialize - runtime only state.
+        NavMeshDataInstance m_NavMeshDataInstance;
+        Vector3 m_LastPosition = Vector3.zero;
+        Quaternion m_LastRotation = Quaternion.identity;
+
+        static readonly List<NavMeshSurface> s_NavMeshSurfaces = new List<NavMeshSurface>();
+
+        public static List<NavMeshSurface> activeSurfaces
+        {
+            get { return s_NavMeshSurfaces; }
+        }
+
+        void OnEnable()
+        {
+            Register(this);
+            AddData();
+        }
+
+        void OnDisable()
+        {
+            RemoveData();
+            Unregister(this);
+        }
+
+        public void AddData()
+        {
+#if UNITY_EDITOR
+            var isInPreviewScene = EditorSceneManager.IsPreviewSceneObject(this);
+            var isPrefab = isInPreviewScene || EditorUtility.IsPersistent(this);
+            if (isPrefab)
+            {
+                //Debug.LogFormat("NavMeshData from {0}.{1} will not be added to the NavMesh world because the gameObject is a prefab.",
+                //    gameObject.name, name);
+                return;
+            }
+#endif
+            if (m_NavMeshDataInstance.valid)
+                return;
+
+            if (m_NavMeshData != null)
+            {
+                m_NavMeshDataInstance = NavMesh.AddNavMeshData(m_NavMeshData, transform.position, transform.rotation);
+                m_NavMeshDataInstance.owner = this;
+            }
+
+            m_LastPosition = transform.position;
+            m_LastRotation = transform.rotation;
+        }
+
+        public void RemoveData()
+        {
+            m_NavMeshDataInstance.Remove();
+            m_NavMeshDataInstance = new NavMeshDataInstance();
+        }
+
+        public NavMeshBuildSettings GetBuildSettings()
+        {
+            var buildSettings = NavMesh.GetSettingsByID(m_AgentTypeID);
+            if (buildSettings.agentTypeID == -1)
+            {
+                Debug.LogWarning("No build settings for agent type ID " + agentTypeID, this);
+                buildSettings.agentTypeID = m_AgentTypeID;
+            }
+
+            if (overrideTileSize)
+            {
+                buildSettings.overrideTileSize = true;
+                buildSettings.tileSize = tileSize;
+            }
+            if (overrideVoxelSize)
+            {
+                buildSettings.overrideVoxelSize = true;
+                buildSettings.voxelSize = voxelSize;
+            }
+            return buildSettings;
+        }
+
+        public void BuildNavMesh()
+        {
+            var sources = CollectSources();
+
+            // Use unscaled bounds - this differs in behaviour from e.g. collider components.
+            // But is similar to reflection probe - and since navmesh data has no scaling support - it is the right choice here.
+            var sourcesBounds = new Bounds(m_Center, Abs(m_Size));
+            if (m_CollectObjects == CollectObjects.All || m_CollectObjects == CollectObjects.Children)
+            {
+                sourcesBounds = CalculateWorldBounds(sources);
+            }
+
+            var data = NavMeshBuilder.BuildNavMeshData(GetBuildSettings(),
+                    sources, sourcesBounds, transform.position, transform.rotation);
+
+            if (data != null)
+            {
+                data.name = gameObject.name;
+                RemoveData();
+                m_NavMeshData = data;
+                if (isActiveAndEnabled)
+                    AddData();
+            }
+        }
+
+        public AsyncOperation UpdateNavMesh(NavMeshData data)
+        {
+            var sources = CollectSources();
+
+            // Use unscaled bounds - this differs in behaviour from e.g. collider components.
+            // But is similar to reflection probe - and since navmesh data has no scaling support - it is the right choice here.
+            var sourcesBounds = new Bounds(m_Center, Abs(m_Size));
+            if (m_CollectObjects == CollectObjects.All || m_CollectObjects == CollectObjects.Children)
+                sourcesBounds = CalculateWorldBounds(sources);
+
+            return NavMeshBuilder.UpdateNavMeshDataAsync(data, GetBuildSettings(), sources, sourcesBounds);
+        }
+
+        static void Register(NavMeshSurface surface)
+        {
+#if UNITY_EDITOR
+            var isInPreviewScene = EditorSceneManager.IsPreviewSceneObject(surface);
+            var isPrefab = isInPreviewScene || EditorUtility.IsPersistent(surface);
+            if (isPrefab)
+            {
+                //Debug.LogFormat("NavMeshData from {0}.{1} will not be added to the NavMesh world because the gameObject is a prefab.",
+                //    surface.gameObject.name, surface.name);
+                return;
+            }
+#endif
+            if (s_NavMeshSurfaces.Count == 0)
+                NavMesh.onPreUpdate += UpdateActive;
+
+            if (!s_NavMeshSurfaces.Contains(surface))
+                s_NavMeshSurfaces.Add(surface);
+        }
+
+        static void Unregister(NavMeshSurface surface)
+        {
+            s_NavMeshSurfaces.Remove(surface);
+
+            if (s_NavMeshSurfaces.Count == 0)
+                NavMesh.onPreUpdate -= UpdateActive;
+        }
+
+        static void UpdateActive()
+        {
+            for (var i = 0; i < s_NavMeshSurfaces.Count; ++i)
+                s_NavMeshSurfaces[i].UpdateDataIfTransformChanged();
+        }
+
+        void AppendModifierVolumes(ref List<NavMeshBuildSource> sources)
+        {
+#if UNITY_EDITOR
+            var myStage = StageUtility.GetStageHandle(gameObject);
+            if (!myStage.IsValid())
+                return;
+#endif
+            // Modifiers
+            List<NavMeshModifierVolume> modifiers;
+            if (m_CollectObjects == CollectObjects.Children)
+            {
+                modifiers = new List<NavMeshModifierVolume>(GetComponentsInChildren<NavMeshModifierVolume>());
+                modifiers.RemoveAll(x => !x.isActiveAndEnabled);
+            }
+            else
+            {
+                modifiers = NavMeshModifierVolume.activeModifiers;
+            }
+
+            foreach (var m in modifiers)
+            {
+                if ((m_LayerMask & (1 << m.gameObject.layer)) == 0)
+                    continue;
+                if (!m.AffectsAgentType(m_AgentTypeID))
+                    continue;
+#if UNITY_EDITOR
+                if (!myStage.Contains(m.gameObject))
+                    continue;
+#endif
+                var mcenter = m.transform.TransformPoint(m.center);
+                var scale = m.transform.lossyScale;
+                var msize = new Vector3(m.size.x * Mathf.Abs(scale.x), m.size.y * Mathf.Abs(scale.y), m.size.z * Mathf.Abs(scale.z));
+
+                var src = new NavMeshBuildSource();
+                src.shape = NavMeshBuildSourceShape.ModifierBox;
+                src.transform = Matrix4x4.TRS(mcenter, m.transform.rotation, Vector3.one);
+                src.size = msize;
+                src.area = m.area;
+                sources.Add(src);
+            }
+        }
+
+        List<NavMeshBuildSource> CollectSources()
+        {
+            var sources = new List<NavMeshBuildSource>();
+            var markups = new List<NavMeshBuildMarkup>();
+
+            List<NavMeshModifier> modifiers;
+            if (m_CollectObjects == CollectObjects.Children)
+            {
+                modifiers = new List<NavMeshModifier>(GetComponentsInChildren<NavMeshModifier>());
+                modifiers.RemoveAll(x => !x.isActiveAndEnabled);
+            }
+            else
+            {
+                modifiers = NavMeshModifier.activeModifiers;
+            }
+
+            foreach (var m in modifiers)
+            {
+                if ((m_LayerMask & (1 << m.gameObject.layer)) == 0)
+                    continue;
+                if (!m.AffectsAgentType(m_AgentTypeID))
+                    continue;
+                var markup = new NavMeshBuildMarkup();
+                markup.root = m.transform;
+                markup.overrideArea = m.overrideArea;
+                markup.area = m.area;
+                markup.ignoreFromBuild = m.ignoreFromBuild;
+                markups.Add(markup);
+            }
+
+#if UNITY_EDITOR
+            if (!EditorApplication.isPlaying)
+            {
+                if (m_CollectObjects == CollectObjects.All)
+                {
+                    UnityEditor.AI.NavMeshBuilder.CollectSourcesInStage(
+                        null, m_LayerMask, m_UseGeometry, m_DefaultArea, markups, gameObject.scene, sources);
+                }
+                else if (m_CollectObjects == CollectObjects.Children)
+                {
+                    UnityEditor.AI.NavMeshBuilder.CollectSourcesInStage(
+                        transform, m_LayerMask, m_UseGeometry, m_DefaultArea, markups, gameObject.scene, sources);
+                }
+                else if (m_CollectObjects == CollectObjects.Volume)
+                {
+                    Matrix4x4 localToWorld = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
+                    var worldBounds = GetWorldBounds(localToWorld, new Bounds(m_Center, m_Size));
+
+                    UnityEditor.AI.NavMeshBuilder.CollectSourcesInStage(
+                        worldBounds, m_LayerMask, m_UseGeometry, m_DefaultArea, markups, gameObject.scene, sources);
+                }
+            }
+            else
+#endif
+            {
+                if (m_CollectObjects == CollectObjects.All)
+                {
+                    NavMeshBuilder.CollectSources(null, m_LayerMask, m_UseGeometry, m_DefaultArea, markups, sources);
+                }
+                else if (m_CollectObjects == CollectObjects.Children)
+                {
+                    NavMeshBuilder.CollectSources(transform, m_LayerMask, m_UseGeometry, m_DefaultArea, markups, sources);
+                }
+                else if (m_CollectObjects == CollectObjects.Volume)
+                {
+                    Matrix4x4 localToWorld = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
+                    var worldBounds = GetWorldBounds(localToWorld, new Bounds(m_Center, m_Size));
+                    NavMeshBuilder.CollectSources(worldBounds, m_LayerMask, m_UseGeometry, m_DefaultArea, markups, sources);
+                }
+            }
+
+            if (m_IgnoreNavMeshAgent)
+                sources.RemoveAll((x) => (x.component != null && x.component.gameObject.GetComponent<NavMeshAgent>() != null));
+
+            if (m_IgnoreNavMeshObstacle)
+                sources.RemoveAll((x) => (x.component != null && x.component.gameObject.GetComponent<NavMeshObstacle>() != null));
+
+            AppendModifierVolumes(ref sources);
+
+            return sources;
+        }
+
+        static Vector3 Abs(Vector3 v)
+        {
+            return new Vector3(Mathf.Abs(v.x), Mathf.Abs(v.y), Mathf.Abs(v.z));
+        }
+
+        static Bounds GetWorldBounds(Matrix4x4 mat, Bounds bounds)
+        {
+            var absAxisX = Abs(mat.MultiplyVector(Vector3.right));
+            var absAxisY = Abs(mat.MultiplyVector(Vector3.up));
+            var absAxisZ = Abs(mat.MultiplyVector(Vector3.forward));
+            var worldPosition = mat.MultiplyPoint(bounds.center);
+            var worldSize = absAxisX * bounds.size.x + absAxisY * bounds.size.y + absAxisZ * bounds.size.z;
+            return new Bounds(worldPosition, worldSize);
+        }
+
+        Bounds CalculateWorldBounds(List<NavMeshBuildSource> sources)
+        {
+            // Use the unscaled matrix for the NavMeshSurface
+            Matrix4x4 worldToLocal = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one);
+            worldToLocal = worldToLocal.inverse;
+
+            var result = new Bounds();
+            foreach (var src in sources)
+            {
+                switch (src.shape)
+                {
+                    case NavMeshBuildSourceShape.Mesh:
+                    {
+                        var m = src.sourceObject as Mesh;
+                        result.Encapsulate(GetWorldBounds(worldToLocal * src.transform, m.bounds));
+                        break;
+                    }
+                    case NavMeshBuildSourceShape.Terrain:
+                    {
+                        // Terrain pivot is lower/left corner - shift bounds accordingly
+                        var t = src.sourceObject as TerrainData;
+                        result.Encapsulate(GetWorldBounds(worldToLocal * src.transform, new Bounds(0.5f * t.size, t.size)));
+                        break;
+                    }
+                    case NavMeshBuildSourceShape.Box:
+                    case NavMeshBuildSourceShape.Sphere:
+                    case NavMeshBuildSourceShape.Capsule:
+                    case NavMeshBuildSourceShape.ModifierBox:
+                        result.Encapsulate(GetWorldBounds(worldToLocal * src.transform, new Bounds(Vector3.zero, src.size)));
+                        break;
+                }
+            }
+            // Inflate the bounds a bit to avoid clipping co-planar sources
+            result.Expand(0.1f);
+            return result;
+        }
+
+        bool HasTransformChanged()
+        {
+            if (m_LastPosition != transform.position) return true;
+            if (m_LastRotation != transform.rotation) return true;
+            return false;
+        }
+
+        void UpdateDataIfTransformChanged()
+        {
+            if (HasTransformChanged())
+            {
+                RemoveData();
+                AddData();
+            }
+        }
+
+#if UNITY_EDITOR
+        bool UnshareNavMeshAsset()
+        {
+            // Nothing to unshare
+            if (m_NavMeshData == null)
+                return false;
+
+            // Prefab parent owns the asset reference
+            var isInPreviewScene = EditorSceneManager.IsPreviewSceneObject(this);
+            var isPersistentObject = EditorUtility.IsPersistent(this);
+            if (isInPreviewScene || isPersistentObject)
+                return false;
+
+            // An instance can share asset reference only with its prefab parent
+            var prefab = UnityEditor.PrefabUtility.GetCorrespondingObjectFromSource(this) as NavMeshSurface;
+            if (prefab != null && prefab.navMeshData == navMeshData)
+                return false;
+
+            // Don't allow referencing an asset that's assigned to another surface
+            for (var i = 0; i < s_NavMeshSurfaces.Count; ++i)
+            {
+                var surface = s_NavMeshSurfaces[i];
+                if (surface != this && surface.m_NavMeshData == m_NavMeshData)
+                    return true;
+            }
+
+            // Asset is not referenced by known surfaces
+            return false;
+        }
+
+        void OnValidate()
+        {
+            if (UnshareNavMeshAsset())
+            {
+                Debug.LogWarning("Duplicating NavMeshSurface does not duplicate the referenced navmesh data", this);
+                m_NavMeshData = null;
+            }
+
+            var settings = NavMesh.GetSettingsByID(m_AgentTypeID);
+            if (settings.agentTypeID != -1)
+            {
+                // When unchecking the override control, revert to automatic value.
+                const float kMinVoxelSize = 0.01f;
+                if (!m_OverrideVoxelSize)
+                    m_VoxelSize = settings.agentRadius / 3.0f;
+                if (m_VoxelSize < kMinVoxelSize)
+                    m_VoxelSize = kMinVoxelSize;
+
+                // When unchecking the override control, revert to default value.
+                const int kMinTileSize = 16;
+                const int kMaxTileSize = 1024;
+                const int kDefaultTileSize = 256;
+
+                if (!m_OverrideTileSize)
+                    m_TileSize = kDefaultTileSize;
+                // Make sure tilesize is in sane range.
+                if (m_TileSize < kMinTileSize)
+                    m_TileSize = kMinTileSize;
+                if (m_TileSize > kMaxTileSize)
+                    m_TileSize = kMaxTileSize;
+            }
+        }
+#endif
+    }
+}

+ 12 - 0
Assets/NavMeshComponents/Scripts/NavMeshSurface.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7a5ac11cc976e418e8d13136b07e1f52
+timeCreated: 1477658803
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {fileID: 2800000, guid: e4f97225bcfb64760a1c81f460837f01, type: 3}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Tests.zip


+ 7 - 0
Assets/Tests.zip.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 55983625a25711b4bb9b6f8365bce5f2
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Documentation.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 262920d2726053d41bb2edcf0bb13d7c
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 13 - 0
Documentation/ConnectingSurfaces.md

@@ -0,0 +1,13 @@
+# Connecting NavMesh Surfaces
+
+![Connecting surfaces example](Images/ConnectingSurfaces-Example.png)
+
+If it is desired to allow an agent to move along multiple NavMesh Surfaces in a Scene, the surfaces need to be connected together using NavMesh Links.
+
+In the example scene above, the blue and red NavMeshes are defined in different NavMesh Surfaces. A wide NavMesh Link is added, it spans from one surface to another.
+
+Things to keep in mind when connecting surfaces:
+* You can connect surfaces using multiple links.
+* Both the surfaces and the link must have same agent type.
+* The link’s start and end point must be only on one surface. It is OK to have multiple NavMeshes at the same location, but then selecting a NavMesh becomes ambiguous.
+* If you are loading a second NavMesh Surface additively and you have “dangling” links in the first scene, check that they do not connect to unwanted surfaces.

+ 7 - 0
Documentation/ConnectingSurfaces.md.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 6d9c6e542e16b394b9e73b010d71870f
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Documentation/Images.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: df74ca9c83177db4ea7c3ba3a85383d1
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Documentation/Images/ConnectingSurfaces-Example.png


+ 91 - 0
Documentation/Images/ConnectingSurfaces-Example.png.meta

@@ -0,0 +1,91 @@
+fileFormatVersion: 2
+guid: 446e78ea725d8ed4db24d637ee11ea52
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 10
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: -1
+    aniso: -1
+    mipBias: -100
+    wrapU: -1
+    wrapV: -1
+    wrapW: -1
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  singleChannelComponent: 0
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Documentation/Images/NavMeshLink-Example.png


+ 91 - 0
Documentation/Images/NavMeshLink-Example.png.meta

@@ -0,0 +1,91 @@
+fileFormatVersion: 2
+guid: c7d5ecf677430094988aec743fad3527
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 10
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: -1
+    aniso: -1
+    mipBias: -100
+    wrapU: -1
+    wrapV: -1
+    wrapW: -1
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  singleChannelComponent: 0
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Documentation/Images/NavMeshModifier-Example.png


+ 91 - 0
Documentation/Images/NavMeshModifier-Example.png.meta

@@ -0,0 +1,91 @@
+fileFormatVersion: 2
+guid: 75b91b2c82547854e8824f244632a089
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 10
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: -1
+    aniso: -1
+    mipBias: -100
+    wrapU: -1
+    wrapV: -1
+    wrapW: -1
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  singleChannelComponent: 0
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Documentation/Images/NavMeshModifierVolume-Example.png


+ 91 - 0
Documentation/Images/NavMeshModifierVolume-Example.png.meta

@@ -0,0 +1,91 @@
+fileFormatVersion: 2
+guid: c4e2fbba7cf5b084a83e6a4e96d0f957
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 10
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: -1
+    aniso: -1
+    mipBias: -100
+    wrapU: -1
+    wrapV: -1
+    wrapW: -1
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  singleChannelComponent: 0
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Documentation/Images/NavMeshSurface-Advanced.png


+ 91 - 0
Documentation/Images/NavMeshSurface-Advanced.png.meta

@@ -0,0 +1,91 @@
+fileFormatVersion: 2
+guid: f4b0665278909ca4da4a47bb4315b38a
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 10
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: -1
+    aniso: -1
+    mipBias: -100
+    wrapU: -1
+    wrapV: -1
+    wrapW: -1
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  singleChannelComponent: 0
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Documentation/Images/NavMeshSurface-Example.png


+ 91 - 0
Documentation/Images/NavMeshSurface-Example.png.meta

@@ -0,0 +1,91 @@
+fileFormatVersion: 2
+guid: f8f8b4fd8e157314f8c19a9e4076c3ec
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 10
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: -1
+    aniso: -1
+    mipBias: -100
+    wrapU: -1
+    wrapV: -1
+    wrapW: -1
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  singleChannelComponent: 0
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 16 - 0
Documentation/NavMeshLink.md

@@ -0,0 +1,16 @@
+# NavMeshLink
+
+![NavMeshLink example](Images/NavMeshLink-Example.png)
+
+NavMesh Link allows to create a navigable link between two locations. The link can be from point-to-point, or it can be wider in which case the agent uses the nearest location along entry edge to cross the link.
+
+The link is necessary to connect different NavMesh Surfaces
+
+* Agent Type – the agent type which can use the link.
+* Start Point – start point of the link, relative to the Game Object.
+* End Point – end point of the link, relative to the Game Object.
+* Align Transform To Points – clicking this button will move the Game Object at the links center point and alight the transform’s forward axis towards the end point.
+* Cost Modifier – When the cost modifier value is non-negative the cost of moving over the NavMeshLink is equivalent to the cost modifier value times the Euclidean distance between NavMeshLink end points.
+* Bidirectional – when checked the link can be traversed from start-to-end and end-to-start, when unchecked only from start-to-end.
+* Area Type – the area type of the link (affects path finding cost) 
+

+ 7 - 0
Documentation/NavMeshLink.md.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 3255e0ee6d39b284497fbb7af2a8ec7f
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 18 - 0
Documentation/NavMeshModifier.md

@@ -0,0 +1,18 @@
+# NavMeshModifier
+
+![NavMeshModifier example](Images/NavMeshModifier-Example.png)
+
+NavMesh Modifier allows to fine tune how a specific object behaves during NavMesh baking. In the above picture, the lower platform has modifier attached to it, which sets the object to have Lava area type. 
+
+The NavMesh Modifier affects hierarchically, that is, the Game Object where the Components is attached and all of its’ children are affected. If another NavMesh Modifier is found further down the transform hierarchy it will override the modification for its children.
+
+The NavMesh Modifier affects the NavMesh generation process, this means the NavMesh has to be updated to reflect changes to NavMesh Modifiers.
+
+Note: This component is a replacement for the old setting which could be enabled from the Navigation window Objects tab as well as the static flags dropdown on the GameObject. This component is available for baking at runtime, whereas the static flags are available in the editor only.
+
+## Parameters
+* Ignore From Build – when checked, the object and all if its’ children are skipped from the build process.
+* Override Area Type – when checked the area type will be overridden for the game object containing the Modifier and all of it’s children.
+	* Area Type – new area type to apply
+* Affected Agents – a selection of agents the Modifier affects. For example, you may choose to exclude certain obstacles from specific agent. 
+

+ 7 - 0
Documentation/NavMeshModifier.md.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 42a9260e34c8b154db9398d129c8a698
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 16 - 0
Documentation/NavMeshModifierVolume.md

@@ -0,0 +1,16 @@
+# NavMeshModifierVolume
+
+![NavMeshModifierVolume example](Images/NavMeshModifierVolume-Example.png)
+
+NavMesh Modifier Volume allows you to mark the area that falls inside the volume with specific area type. Where NavMesh Modifier marks certain objects with an area type, the Modifier Volume allows change the area type even more locally based on a volume.
+
+The modifier is useful for annotating certain areas over walkable surfaces which might not be represented as separate geometry, e.g. danger areas.  It can be even be used to make certain areas non-walkable.
+
+The NavMesh Modifier Volume affects the NavMesh generation process, this means the NavMesh has to be updated to reflect changes to NavMesh Modifier Volumes.
+
+## Parameters
+* Size – dimensions of the modifier volume. 
+* Center – center of the modifier volume relative to the GameObject center.
+* Area Type – describes the area type which the volume applies.
+* Affected Agents – a selection of agents the Modifier affects. For example, you may choose to create danger zone for specific agent type only.
+

+ 7 - 0
Documentation/NavMeshModifierVolume.md.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 58d1aa8e1c869dd45a09df8cd3b391ac
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 37 - 0
Documentation/NavMeshSurface.md

@@ -0,0 +1,37 @@
+# NavMeshSurface
+
+![NavMeshSurface example](Images/NavMeshSurface-Example.png)
+
+The NavMeshSurface component represents the walkable area for a specific agent type. The NavMesh Surface component defines a part of the world where a NavMesh should be built. A scene can contain multiple NavMesh Surfaces.
+
+The preferred way to use the NavMeshSurface component is to create an empty Game Object containing the NavMeshSurface component. There’s a menu option for that: GameObject > AI > NavMesh Surface. This creates an empty Game Object with a NavMeshSurface component attached to it.
+
+The NavMeshSurface component can be also added to any game object. This is useful for cases where you want to use the Hierarchy to define which objects contribute to the NavMesh.
+
+## Parameters
+* Agent Type – the agent type which will use this NavMesh Surface. The agent type is used for bake settings, as well as to match a NavMeshAgent to proper surface during pathfinding.
+* Collect Objects – defines on a high level which objects should be used for baking.
+	* All – use all active objects.
+	* Volume – use all active objects overlapping the bounding volume (defined later) 
+	* Children – use all active objects which are children to the NavMeshSurface component, in addition to the object the component is placed on.
+* Include Layers – defines the layers on which the objects must be to be included in the bake. This allows further culling of objects from inclusion in the bake e.g. effects or animated characters.
+* Use Geometry – selects which geometry is used for baking.
+* Render Meshes – use geometry from rendered meshes and terrains
+* Physics Colliders – use geometry from colliders and terrains. When using physics this is usually a better option than Render Meshes. This way the agents will be closer to the physical bounds of the environment.
+
+The main settings for the NavMesh Surface component allow you to filter the input geometry on a broad scale. To fine tune how input geometry is treated on a per-object level when building a navmesh, see NavMeshModifer component.
+
+Game Objects which have a NavMesh Agent or NavMesh Obstacle will be excluded from the baking process automatically. They are dynamic users of the navmesh – and hence should not contribute to the navmesh building.
+
+## Advanced Settings
+
+![NavMeshSurface advanced](Images/NavMeshSurface-Advanced.png)
+
+
+The main settings will cater for most use cases, but for anything not covered by the main settings, the advanced section has the following additional parameters
+
+* Default Area – defines the area type generated when building the navmesh. The default value is Walkable. The NavMeshModifer component can be used to modify the area type in more detail.
+* Override Voxel Size – The override voxel size controls how accurately the input geometry is processed for NavMesh baking. It is a tradeoff between speed and accuracy. A good value to start with is 3 voxels per agent radius (6 per diameter). This allows to capture most of the narrow passages, like doors and still have quick baking. If you have big open areas, you might go down to 1 or 2 to speed things up. Or if you have tight indoor spots, you can use smaller voxels, and use maybe 4-6 voxels per radius. More than 8 is usually not really worth it.   
+* Override Tile Size – In order to make the bake process parallel and memory efficient, the world is divided into tiles for baking. The white lines you can see on your NavMesh are tile boundaries. The default tiles size is 256 voxels. It is a good trade-off between memory usage and NavMesh fragmentation. The smaller the tiles are the more fragmented the NavMesh is, and this can sometimes cause non-optimal paths. NavMesh carving also operates on tiles. If you have a lot of obstacles, you can potentially speed up carving by making the tile size smaller, say 64-128. Also, if you plan to bake the NavMesh at runtime, you may choose to use smaller tile size to keep the maximum memory usage low.
+* Build Height Mesh – Not supported yet.
+

+ 7 - 0
Documentation/NavMeshSurface.md.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 92e737eddb9a7a94ba82d29fde286637
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 15 - 0
Documentation/README.md

@@ -0,0 +1,15 @@
+# High-level NavMesh Building Components
+
+Here we introduce four high level components for the navigation system:
+
+* [NavMeshSurface](NavMeshSurface.md) – for building and enabling a navmesh surface for one agent type.
+* [NavMeshModifier](NavMeshModifier.md) – affects the navmesh generation of navmesh area types, based on the transform hierarchy.
+* [NavMeshModifierVolume](NavMeshModifierVolume.md) – affects the navmesh generation of navmesh area types, based on volume.
+* [NavMeshLink](NavMeshLink.md) – connects same or different navmesh surfaces for one agent type.
+
+These components comprise the high level controls for building and using NavMeshes at runtime as well as edit time.
+
+## Techniques and Patterns
+* [Connecting NavMesh Surfaces](ConnectingSurfaces.md) using the NavMeshLink compoenent.
+
+

+ 7 - 0
Documentation/README.md.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: bbc6a46ce75180f4d97c73b457095c19
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016, Unity Technologies
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

+ 7 - 0
LICENSE.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 456415a264b38ed4198afd2f7014e68d
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Packages.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 29ccc3756508a344ab542b6179b2bc73
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 40 - 0
Packages/manifest.json

@@ -0,0 +1,40 @@
+{
+  "dependencies": {
+    "com.unity.ide.rider": "1.1.4",
+    "com.unity.ide.visualstudio": "1.0.11",
+    "com.unity.ide.vscode": "1.1.4",
+    "com.unity.test-framework": "1.1.11",
+    "com.unity.ugui": "1.0.0",
+    "com.unity.modules.ai": "1.0.0",
+    "com.unity.modules.androidjni": "1.0.0",
+    "com.unity.modules.animation": "1.0.0",
+    "com.unity.modules.assetbundle": "1.0.0",
+    "com.unity.modules.audio": "1.0.0",
+    "com.unity.modules.cloth": "1.0.0",
+    "com.unity.modules.director": "1.0.0",
+    "com.unity.modules.imageconversion": "1.0.0",
+    "com.unity.modules.imgui": "1.0.0",
+    "com.unity.modules.jsonserialize": "1.0.0",
+    "com.unity.modules.particlesystem": "1.0.0",
+    "com.unity.modules.physics": "1.0.0",
+    "com.unity.modules.physics2d": "1.0.0",
+    "com.unity.modules.screencapture": "1.0.0",
+    "com.unity.modules.terrain": "1.0.0",
+    "com.unity.modules.terrainphysics": "1.0.0",
+    "com.unity.modules.tilemap": "1.0.0",
+    "com.unity.modules.ui": "1.0.0",
+    "com.unity.modules.uielements": "1.0.0",
+    "com.unity.modules.umbra": "1.0.0",
+    "com.unity.modules.unityanalytics": "1.0.0",
+    "com.unity.modules.unitywebrequest": "1.0.0",
+    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
+    "com.unity.modules.unitywebrequestaudio": "1.0.0",
+    "com.unity.modules.unitywebrequesttexture": "1.0.0",
+    "com.unity.modules.unitywebrequestwww": "1.0.0",
+    "com.unity.modules.vehicles": "1.0.0",
+    "com.unity.modules.video": "1.0.0",
+    "com.unity.modules.vr": "1.0.0",
+    "com.unity.modules.wind": "1.0.0",
+    "com.unity.modules.xr": "1.0.0"
+  }
+}

+ 7 - 0
Packages/manifest.json.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 6c61f49a5d6683a4898e775c5287da42
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
ProjectSettings.zip


+ 7 - 0
ProjectSettings.zip.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 726d35d811f6caf43b47ee00588b5ef4
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 60 - 0
README.md

@@ -0,0 +1,60 @@
+> Please use the branch matching the version of your Unity editor: [master](../../tree/master) for the latest released version, [2019.3](../../tree/2019.3), [2018.3](../../tree/2018.3) for up to 2018.4-LTS and 2019.2, [2018.2](../../tree/2018.2), [2018.1](../../tree/2018.1), [2017.2](../../tree/2017.2) for up to 2017.4-LTS, [2017.1](../../tree/2017.1), [5.6](../../tree/5.6).
+
+# Components for Runtime NavMesh Building
+
+Here we introduce four components for the navigation system:
+
+* __NavMeshSurface__ – for building and enabling a NavMesh surface for one agent type.
+* __NavMeshModifier__ – affects the NavMesh generation of NavMesh area types, based on the transform hierarchy.
+* __NavMeshModifierVolume__ – affects the NavMesh generation of NavMesh area types, based on volume.
+* __NavMeshLink__ – connects same or different NavMesh surfaces for one agent type.
+
+These components comprise the high level controls for building and using NavMeshes at runtime as well as edit time.
+
+Detailed information can be found in the [Documentation](Documentation) section or in the [NavMesh building components](https://docs.unity3d.com/Manual/NavMesh-BuildingComponents.html) section of the Unity Manual.
+
+# How To Get Started
+
+Download and install Unity 5.6 or newer.
+
+Clone or download this repository and open the project in Unity.
+Alternatively, you can copy the contents of `Assets/NavMeshComponents` to an existing project. Make sure to select a branch of the repository that matches the Unity version.
+
+Additional examples are available in the `Assets/Examples` folder.
+The examples are provided "as is". They are neither generic nor robust, but serve as inspiration.
+
+_Note: During the beta cycle features and API are subject to change.\
+**Make sure to backup an existing project before opening it with a beta build.**_
+
+# FAQ
+
+Q: Can I bake a NavMesh at runtime?  
+A: Yes.
+
+Q: Can I use NavMesh'es for more than one agent size?  
+A: Yes.
+
+Q: Can I put a NavMesh in a prefab?  
+A: Yes - with some limitations.
+
+Q: How do I connect two NavMesh surfaces?  
+A: Use the NavMeshLink to connect the two sides.
+
+Q: How do I query the NavMesh for one specific size of agent?  
+A: Use the NavMeshQuery filter when querying the NavMesh.
+
+Q: What's the deal with the 'DefaultExecutionOrder' attribute?  
+A: It gives a way of controlling the order of execution of scripts - specifically it allows us to build a NavMesh before the
+(native) NavMeshAgent component is enabled.
+
+Q: What's the use of the new delegate 'NavMesh.onPreUpdate'?  
+A: It allows you to hook in to controlling the NavMesh data and links set up before the navigation update loop is called on the native side.
+
+Q: Can I do moving NavMesh platforms?  
+A: No - new API is required for consistently moving platforms carrying agents.
+
+Q: Is OffMeshLink now obsolete?  
+A: No - you can still use OffMeshLink - however you'll find that NavMeshLink is more flexible and have less overhead.
+
+Q: What happened to HeightMesh and Auto Generated OffMeshLinks?  
+A: They're not supported in the new NavMesh building feature. HeightMesh will be added at some point. Auto OffMeshLink generation will possibly be replaced with a solution that allows better control of placement.

+ 7 - 0
README.md.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 480866d7588f6ce44a7001788f8b1017
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 16 - 0
package.json

@@ -0,0 +1,16 @@
+{
+    "name": "at.kairoscope.thirdparty.nav-mesh-components",
+    "displayName":  "Mixpanel",
+    "version": "2019.3",
+    "description": "Official Unity package for generating NavMeshes in runtime.",
+    "repository": {
+      "type": "git",
+      "url": "https://git.kairoscope.net/third-party/nav-mesh-components.git"
+    },
+    "author": "Kairoscope",
+    "license": "Apache V2",
+    "keywords": [
+      "unity3d",
+      "unity3d-package"
+    ]
+  }

+ 7 - 0
package.json.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: a6b5f7b09214c444390c393756439a4f
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: