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

        EditorGUI.BeginChangeCheck();
        if (GUILayout.Button("Add Boost"))
        {
            Undo.RecordObject(myCreator, "Add Boost");
            myCreator.AddBoost();
        }

        if (GUILayout.Button("Delete Boost"))
        {
            Undo.RecordObject(myCreator, "Delete Boost");
            myCreator.DeleteBoost();
        }

        if (GUILayout.Button("DELETE and start over"))
        {
            Undo.RecordObject(myCreator, "DELETE and start over");
            myCreator.StartOver();
        }

        bool isClosed = GUILayout.Toggle(myPath.IsClosed, "Closed");

        if (isClosed != myPath.IsClosed)
        {
            Undo.RecordObject(myCreator, "Toggle closed");
            myPath.IsClosed = isClosed;
        }

        bool autoSetControlPoints = GUILayout.Toggle(myPath.AutoSetControlPoints, "Auto Set Control Points");

        if (autoSetControlPoints != myPath.AutoSetControlPoints)
        {
            Undo.RecordObject(myCreator, "Toggle auto set controls");
            myPath.AutoSetControlPoints = autoSetControlPoints;
        }

        if (EditorGUI.EndChangeCheck())
        {
            SceneView.RepaintAll();
        }
    }