Ejemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        serializedObject.Update();
        GraphViewer viewer = target as GraphViewer;

        if (GUILayout.Button("Generate Dungeon"))
        {
            viewer.GenerateDungeon();
            UnityEditor.EditorApplication.QueuePlayerLoopUpdate();
            UnityEditor.SceneView.RepaintAll();
        }
        if (GUILayout.Button("Delete Graph"))
        {
            viewer.DeleteGraph();
            UnityEditor.EditorApplication.QueuePlayerLoopUpdate();
            UnityEditor.SceneView.RepaintAll();
        }
        if (viewer.loopGeneration)
        {
            // Ensure continuous Update calls.
            if (!Application.isPlaying)
            {
                UnityEditor.EditorApplication.QueuePlayerLoopUpdate();
                UnityEditor.SceneView.RepaintAll();
            }
        }
        serializedObject.ApplyModifiedProperties();
    }