Exemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        if (GUILayout.Button("Connect"))
        {
            GameObject[] points = Selection.gameObjects;
            if (points.Length == 2 && points[0].GetComponent <PathPoint>() != null && points[1].GetComponent <PathPoint>() != null)
            {
                pathFinder.ConnectPath(points[0], points[1]);
            }
        }

        if (GUILayout.Button("Disconnect"))
        {
            GameObject[] points = Selection.gameObjects;
            if (points.Length == 2 && points[0].GetComponent <PathPoint>() != null && points[1].GetComponent <PathPoint>() != null)
            {
                pathFinder.DisconnectPath(points[0], points[1]);
            }
        }

        // 1. update the dirty data
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
    }