We will create an editor window for easily handling the automation process without weighing down the graph's Start function, thereby delaying the scene loading:
- Create the CustomNavMeshWindow class and place it in a directory called Editor:
using UnityEngine; using UnityEditor; using System.Collections; using System.Collections.Generic; public class CustomNavMeshWindow : EditorWindow { // next steps here }
- Add the attributes to the editor window:
static bool isEnabled = false; static GameObject graphObj; static CustomNavMesh graph; static CustomNavMeshWindow window; static GameObject graphVertex;
- Implement the function for initializing and showing the window:
[MenuItem("UAIPC/Ch02/CustomNavMeshWindow")] static void ...