public void UpdateNavMesh() { foreach (GameObject go in GameObject.FindGameObjectsWithTag("Navable")) { NavigationBaker navigationBaker = go.GetComponent <NavigationBaker>(); if (navigationBaker != null) { navigationBaker.Bake(); Debug.Log("Telling " + go.name + " to re-bake navmesh"); } } }
private void GenerateMap() { if (UseRandomSeed) { Seed = DateTime.Now.ToString(); } DateTime start = DateTime.Now; RandomFillMap(Seed, FillPercent); SmoothMap(); ProcessMap(); MeshGenerator meshGenerator = GetComponent <MeshGenerator>(); meshGenerator.GenerateMesh(map, 1f); navMeshBaker = GetComponent <NavigationBaker>(); navMeshBaker.Bake(); Debug.Log(string.Format("Map generation total time: {0} ms", (DateTime.Now - start).Milliseconds)); }