static void Unregister(NavMeshSurfaceNBLD surface) { s_NavMeshSurfaces.Remove(surface); if (s_NavMeshSurfaces.Count == 0) { NavMesh.onPreUpdate -= UpdateActive; } }
static void Register(NavMeshSurfaceNBLD 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); } }