private void OnSceneGUI(SceneView sceneView) { if (!(ScriptableObject)mNavmeshData) { Hide(); return; } if (!mNavmeshData.HasNavmesh) { mDataVersion = -1; mNavmesh = null; return; } if (mNavmesh == null || mNavmeshData.Version != mDataVersion) { mNavmesh = mNavmeshData.GetNavmesh(); mDataVersion = mNavmeshData.Version; if (mNavmesh == null) { return; } } NavDebug.Draw(mNavmesh, mColorByArea); }
void OnRenderObject() { if (!mDebugEnabled) { return; } INavmeshData data = NavmeshData; if (!mNavmeshData || !data.HasNavmesh) { mDebugMesh = null; return; } if (mDebugMesh == null || data.Version != mDebugVersion) { mDebugMesh = data.GetNavmesh(); mDebugVersion = data.Version; if (mDebugMesh == null) { return; } } NavDebug.Draw(mDebugMesh, false); }
internal bool CanLoadFromTarget(BuildContext context, bool fullCheck) { INavmeshData target = BuildTarget; if (target == null || !target.HasNavmesh) { if (context != null) { context.LogError("Build target does not have an existing navigation mesh.", this); } return(false); } NavmeshBuildInfo targetConfig = target.BuildInfo; // Note: The tile size is checked since the original builder // may have supported a tile size not supported by the the standard build. if (targetConfig == null || targetConfig.tileSize >= 0 && targetConfig.tileSize < MinAllowedTileSize) { if (context != null) { context.LogError("Unavailable or unsupported build target configuration.", this); } return(false); } if (!fullCheck) { return(true); } Navmesh nm = target.GetNavmesh(); if (nm == null) { if (context != null) { context.LogError( "Build target does not have an existing navigation mesh. (It lied.)", this); } return(false); } NavmeshParams nmConfig = nm.GetConfig(); if (nmConfig.maxTiles < 2) { if (context != null) { context.LogError("Target navigation mesh is not tiled.", this); } return(false); } int tileCount = 0; for (int i = 0; i < nmConfig.maxTiles; i++) { NavmeshTile tile = nm.GetTile(i); if (tile == null) { continue; } NavmeshTileHeader header = tile.GetHeader(); if (header.polyCount == 0) { continue; } tileCount++; if (header.layer > 0) { if (context != null) { context.LogError( "Target navigation mesh contains layered tiles. (Not supported.)", this); } return(false); } } if (tileCount < 2) { if (context != null) { context.LogError( "Target navigation mesh is either not tiled or has no tiles loaded.", this); } return(false); } return(true); }