예제 #1
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(10);
        EditorGUILayout.HelpBox(explanation, MessageType.Info);

        EditorGUILayout.PropertyField(serializedObject.FindProperty("speed"));

        GUILayout.Space(5);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("backToStart"));
        list.DoLayoutList();

        //Button to reset all waypoints
        EditorGUILayout.Space();
        if (GUILayout.Button("Reset Waypoints"))
        {
            patrolScript.Reset();
            EditorApplication.Beep();

            //force both the custom Inspector and the Scene View to show the changes
            Repaint();
            SceneView.RepaintAll();
        }

        GUILayout.Space(5);
        GUILayout.Label("Orientation", EditorStyles.boldLabel);
        bool orientToDirectionTemp = EditorGUILayout.Toggle("Orient to direction", serializedObject.FindProperty("orientToDirection").boolValue);

        if (orientToDirectionTemp)
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("lookAxis"));
        }
        serializedObject.FindProperty("orientToDirection").boolValue = orientToDirectionTemp;

        serializedObject.ApplyModifiedProperties();
    }