示例#1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        grid = target as LevelGrid;

        EditorGUI.BeginChangeCheck();

        if (GUILayout.Button("Generate Empty Grid"))
        {
            Undo.RecordObject(grid, "Generate Empty Grid");
            grid.GenerateEmptyGridEditor();
            EditorUtility.SetDirty(grid);
        }

        if (GUILayout.Button("Clear Grid"))
        {
            Undo.RecordObject(grid, "Clear Grid");
            grid.ClearGridEditor();
            EditorUtility.SetDirty(grid);
        }

        if (GUILayout.Button("Update Grid"))
        {
            Undo.RecordObject(grid, "Update Grid");
            grid.UpdateGrid();
            EditorUtility.SetDirty(grid);
        }
    }