FindTagNames() public static method

public static FindTagNames ( ) : string[]
return string[]
Exemplo n.º 1
0
    public static int TagField(string label, int value)
    {
        // Make sure the tagNamesAndEditTagsButton is relatively up to date
        if (tagNamesAndEditTagsButton == null || EditorApplication.timeSinceStartup - timeLastUpdatedTagNames > 1)
        {
            timeLastUpdatedTagNames = EditorApplication.timeSinceStartup;
            var tagNames = AstarPath.FindTagNames();
            tagNamesAndEditTagsButton = new string[tagNames.Length + 1];
            tagNames.CopyTo(tagNamesAndEditTagsButton, 0);
            tagNamesAndEditTagsButton[tagNamesAndEditTagsButton.Length - 1] = "Edit Tags...";
        }

        // Tags are between 0 and 31
        value = Mathf.Clamp(value, 0, 31);

        var newValue = EditorGUILayout.IntPopup(label, value, tagNamesAndEditTagsButton, new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, -1 });

        // Last element corresponds to the 'Edit Tags...' entry. Open the tag editor
        if (newValue == -1)
        {
            AstarPathEditor.EditTags();
        }
        else
        {
            value = newValue;
        }

        return(value);
    }
Exemplo n.º 2
0
    public static void SetTagField(GUIContent label, ref Pathfinding.TagMask value)
    {
        GUILayout.BeginHorizontal();

        //Debug.Log (value.ToString ());
        EditorGUIUtility.LookLikeControls();
        EditorGUILayout.PrefixLabel(label, EditorStyles.layerMaskField);
        //GUILayout.FlexibleSpace ();
        //Rect r = GUILayoutUtility.GetLastRect ();

        string text = "";

        if (value.tagsChange == 0)
        {
            text = "Nothing";
        }
        else if (value.tagsChange == ~0)
        {
            text = "Everything";
        }
        else
        {
            text = System.Convert.ToString(value.tagsChange, 2);
        }

        string[] tagNames = AstarPath.FindTagNames();

        if (GUILayout.Button(text, EditorStyles.layerMaskField, GUILayout.ExpandWidth(true)))
        {
            //Debug.Log ("pre");
            GenericMenu menu = new GenericMenu();

            menu.AddItem(new GUIContent("Everything"), value.tagsChange == ~0, value.SetValues, new Pathfinding.TagMask(~0, value.tagsSet));
            menu.AddItem(new GUIContent("Nothing"), value.tagsChange == 0, value.SetValues, new Pathfinding.TagMask(0, value.tagsSet));

            for (int i = 0; i < tagNames.Length; i++)
            {
                bool on = (value.tagsChange >> i & 0x1) != 0;
                Pathfinding.TagMask result = new Pathfinding.TagMask(on ? value.tagsChange & ~(1 << i) : value.tagsChange | 1 << i, value.tagsSet);
                menu.AddItem(new GUIContent(tagNames[i]), on, value.SetValues, result);
                //value.SetValues (result);
            }

            menu.AddItem(new GUIContent("Edit Tags..."), false, AstarPathEditor.EditTags);
            menu.ShowAsContext();

            Event.current.Use();
            //Debug.Log ("Post");
        }

        EditorGUIUtility.LookLikeInspector();
        GUILayout.EndHorizontal();
    }
Exemplo n.º 3
0
    public static void TagMaskField(GUIContent label, int value, System.Action <int> callback)
    {
        GUILayout.BeginHorizontal();

        EditorGUIUtility.LookLikeControls();
        EditorGUILayout.PrefixLabel(label, EditorStyles.layerMaskField);

        string text;

        if (value == 0)
        {
            text = "Nothing";
        }
        else if (value == ~0)
        {
            text = "Everything";
        }
        else
        {
            text = System.Convert.ToString(value, 2);
        }

        string[] tagNames = AstarPath.FindTagNames();

        if (GUILayout.Button(text, EditorStyles.layerMaskField, GUILayout.ExpandWidth(true)))
        {
            GenericMenu.MenuFunction2 wrappedCallback = obj => callback((int)obj);

            var menu = new GenericMenu();

            menu.AddItem(new GUIContent("Everything"), value == ~0, wrappedCallback, ~0);
            menu.AddItem(new GUIContent("Nothing"), value == 0, wrappedCallback, 0);

            for (int i = 0; i < tagNames.Length; i++)
            {
                bool on     = (value >> i & 1) != 0;
                int  result = on ? value & ~(1 << i) : value | 1 << i;
                menu.AddItem(new GUIContent(tagNames[i]), on, wrappedCallback, result);
            }

            // Shortcut to open the tag editor
            menu.AddItem(new GUIContent("Edit Tags..."), false, AstarPathEditor.EditTags);
            menu.ShowAsContext();

            Event.current.Use();
        }

        GUILayout.EndHorizontal();
    }
Exemplo n.º 4
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        var script = target as Seeker;

        Undo.RecordObject(script, "modify settings on Seeker");

        // Show a dropdown selector for the tags that this seeker can traverse
        // A callback is necessary because Unity's GenericMenu uses callbacks
        EditorGUILayoutx.TagMaskField(new GUIContent("Valid Tags"), script.traversableTags, result => script.traversableTags = result);

#if !ASTAR_NoTagPenalty
        EditorGUI.indentLevel = 0;
        tagPenaltiesOpen      = EditorGUILayout.Foldout(tagPenaltiesOpen, new GUIContent("Tag Penalties", "Penalties for each tag"));
        if (tagPenaltiesOpen)
        {
            EditorGUI.indentLevel = 2;
            string[] tagNames = AstarPath.FindTagNames();
            for (int i = 0; i < script.tagPenalties.Length; i++)
            {
                int tmp = EditorGUILayout.IntField((i < tagNames.Length ? tagNames[i] : "Tag " + i), (int)script.tagPenalties[i]);
                if (tmp < 0)
                {
                    tmp = 0;
                }

                // If the new value is different than the old one
                // Update the value and mark the script as dirty
                if (script.tagPenalties[i] != tmp)
                {
                    script.tagPenalties[i] = tmp;
                    EditorUtility.SetDirty(target);
                }
            }
            if (GUILayout.Button("Edit Tag Names..."))
            {
                AstarPathEditor.EditTags();
            }
        }
        EditorGUI.indentLevel = 1;
#endif

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Exemplo n.º 5
0
    public static int SingleTagField(string label, int value)
    {
        //GUILayout.BeginHorizontal ();

        //Debug.Log (value.ToString ());
        //EditorGUIUtility.LookLikeControls();
        ///EditorGUILayout.PrefixLabel (label,EditorStyles.layerMaskField);
        //GUILayout.FlexibleSpace ();
        //Rect r = GUILayoutUtility.GetLastRect ();



        string[] tagNames = AstarPath.FindTagNames();
        value = value < 0 ? 0 : value;
        value = value >= tagNames.Length ? tagNames.Length - 1 : value;

        //string text = tagNames[value];

        /*if (GUILayout.Button (text,EditorStyles.layerMaskField,GUILayout.ExpandWidth (true))) {
         *
         *      //Debug.Log ("pre");
         *      GenericMenu menu = new GenericMenu ();
         *
         *      for (int i=0;i<tagNames.Length;i++) {
         *              bool on = value == i;
         *              int result = i;
         *              menu.AddItem (new GUIContent (tagNames[i]),on,delegate (System.Object ob) { value = (int)ob; }, result);
         *              //value.SetValues (result);
         *      }
         *
         *      menu.AddItem (new GUIContent ("Edit Tags..."),false,AstarPathEditor.EditTags);
         *      menu.ShowAsContext ();
         *
         *      Event.current.Use ();
         *      //Debug.Log ("Post");
         * }*/
        value = EditorGUILayout.IntPopup(label, value, tagNames, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 });

        //EditorGUIUtility.LookLikeInspector();
        //GUILayout.EndHorizontal ();

        return(value);
    }
Exemplo n.º 6
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Seeker script = target as Seeker;

#if !UNITY_LE_4_3
        Undo.RecordObject(script, "modify settings on Seeker");
#endif

        EditorGUILayoutx.SetTagField(new GUIContent("Valid Tags"), ref script.traversableTags);

#if !ASTAR_NoTagPenalty
        EditorGUI.indentLevel = 0;
        tagPenaltiesOpen      = EditorGUILayout.Foldout(tagPenaltiesOpen, new GUIContent("Tag Penalties", "Penalties for each tag"));
        if (tagPenaltiesOpen)
        {
            EditorGUI.indentLevel = 2;
            string[] tagNames = AstarPath.FindTagNames();
            for (int i = 0; i < script.tagPenalties.Length; i++)
            {
                int tmp = EditorGUILayout.IntField((i < tagNames.Length ? tagNames[i] : "Tag " + i), (int)script.tagPenalties[i]);
                if (tmp < 0)
                {
                    tmp = 0;
                }
                script.tagPenalties[i] = tmp;
            }
            if (GUILayout.Button("Edit Tag Names..."))
            {
                AstarPathEditor.EditTags();
            }
        }
        EditorGUI.indentLevel = 1;
#endif

        //Do some loading and checking
        if (!AstarPathEditor.stylesLoaded)
        {
            if (!AstarPathEditor.LoadStyles())
            {
                if (AstarPathEditor.upArrow == null)
                {
                    AstarPathEditor.upArrow   = GUI.skin.FindStyle("Button");
                    AstarPathEditor.downArrow = AstarPathEditor.upArrow;
                }
            }
            else
            {
                AstarPathEditor.stylesLoaded = true;
            }
        }

        GUIStyle helpBox = GUI.skin.GetStyle("helpBox");


        if (mods == null)
        {
            mods = new List <IPathModifier>(script.GetComponents <MonoModifier>() as IPathModifier[]);
        }
        else
        {
            mods.Clear();
            mods.AddRange(script.GetComponents <MonoModifier>() as IPathModifier[]);
        }

        mods.Add(script.startEndModifier as IPathModifier);

        bool changed = true;
        while (changed)
        {
            changed = false;
            for (int i = 0; i < mods.Count - 1; i++)
            {
                if (mods[i].Priority < mods[i + 1].Priority)
                {
                    IPathModifier tmp = mods[i + 1];
                    mods[i + 1] = mods[i];
                    mods[i]     = tmp;
                    changed     = true;
                }
            }
        }

        for (int i = 0; i < mods.Count; i++)
        {
            if (mods.Count - i != mods[i].Priority)
            {
                mods[i].Priority = mods.Count - i;
                GUI.changed      = true;
                EditorUtility.SetDirty(target);
            }
        }

        bool modifierErrors = false;

        IPathModifier prevMod = mods[0];

        //Loops through all modifiers and checks if there are any errors in converting output between modifiers
        for (int i = 1; i < mods.Count; i++)
        {
            MonoModifier monoMod = mods[i] as MonoModifier;
            if ((prevMod as MonoModifier) != null && !(prevMod as MonoModifier).enabled)
            {
                if (monoMod == null || monoMod.enabled)
                {
                    prevMod = mods[i];
                }
                continue;
            }

            if ((monoMod == null || monoMod.enabled) && prevMod != mods[i] && !ModifierConverter.CanConvert(prevMod.output, mods[i].input))
            {
                modifierErrors = true;
            }

            if (monoMod == null || monoMod.enabled)
            {
                prevMod = mods[i];
            }
        }

        EditorGUI.indentLevel = 0;

#if UNITY_LE_4_3
        modifiersOpen = EditorGUILayout.Foldout(modifiersOpen, "Modifiers Priorities" + (modifierErrors ? " - Errors in modifiers!" : ""), EditorStyles.foldout);
#else
        modifiersOpen = EditorGUILayout.Foldout(modifiersOpen, "Modifiers Priorities" + (modifierErrors ? " - Errors in modifiers!" : ""));
#endif

#if UNITY_LE_4_3
        EditorGUI.indentLevel = 1;
#endif

        if (modifiersOpen)
        {
#if UNITY_LE_4_3
            EditorGUI.indentLevel += 2;
#endif

            //GUILayout.BeginHorizontal ();
            //GUILayout.Space (28);
            if (GUILayout.Button("Modifiers attached to this gameObject are listed here.\nModifiers with a higher priority (higher up in the list) will be executed first.\nClick here for more info", helpBox))
            {
                Application.OpenURL(AstarPathEditor.GetURL("modifiers"));
            }


            EditorGUILayout.HelpBox("Original or All can be converted to anything\n" +
                                    "NodePath can be converted to VectorPath\n" +
                                    "VectorPath can only be used as VectorPath\n" +
                                    "Vector takes both VectorPath and StrictVectorPath\n" +
                                    "Strict... can be converted to the non-strict variant", MessageType.None);
            //GUILayout.EndHorizontal ();

            prevMod = mods[0];

            for (int i = 0; i < mods.Count; i++)
            {
                //EditorGUILayout.LabelField (mods[i].GetType ().ToString (),mods[i].Priority.ToString ());
                MonoModifier monoMod = mods[i] as MonoModifier;

                Color prevCol = GUI.color;
                if (monoMod != null && !monoMod.enabled)
                {
                    GUI.color *= new Color(1, 1, 1, 0.5F);
                }

                GUILayout.BeginVertical(GUI.skin.box);

                if (i > 0)
                {
                    if ((prevMod as MonoModifier) != null && !(prevMod as MonoModifier).enabled)
                    {
                        prevMod = mods[i];
                    }
                    else
                    {
                        if ((monoMod == null || monoMod.enabled) && !ModifierConverter.CanConvert(prevMod.output, mods[i].input))
                        {
                            //GUILayout.BeginHorizontal ();
                            //GUILayout.Space (28);
                            GUIUtilityx.SetColor(new Color(0.8F, 0, 0));
                            GUILayout.Label("Cannot convert " + prevMod.GetType().Name + "'s output to " + mods[i].GetType().Name + "'s input\nRearranging the modifiers might help", EditorStyles.whiteMiniLabel);
                            GUIUtilityx.ResetColor();
                            //GUILayout.EndHorizontal ();
                        }

                        if (monoMod == null || monoMod.enabled)
                        {
                            prevMod = mods[i];
                        }
                    }
                }

                GUILayout.Label("Input: " + mods[i].input, EditorStyles.wordWrappedMiniLabel);
                int newPrio = EditorGUILayoutx.UpDownArrows(new GUIContent(ObjectNames.NicifyVariableName(mods[i].GetType().ToString())), mods[i].Priority, EditorStyles.label, AstarPathEditor.upArrow, AstarPathEditor.downArrow);

                GUILayout.Label("Output: " + mods[i].output, EditorStyles.wordWrappedMiniLabel);

                GUILayout.EndVertical();

                int diff = newPrio - mods[i].Priority;

                if (i > 0 && diff > 0)
                {
                    mods[i - 1].Priority = mods[i].Priority;
                }
                else if (i < mods.Count - 1 && diff < 0)
                {
                    mods[i + 1].Priority = mods[i].Priority;
                }

                mods[i].Priority = newPrio;

                GUI.color = prevCol;
            }

#if UNITY_LE_4_3
            EditorGUI.indentLevel -= 2;
#endif
        }
    }
Exemplo n.º 7
0
    public override void OnInspectorGUI()
    {
        GraphUpdateScene script = target as GraphUpdateScene;

#if !UNITY_LE_4_3
        Undo.RecordObject(script, "modify settings on GraphUpdateObject");
#endif

        if (script.points == null)
        {
            script.points = new Vector3[0];
        }

        if (script.points == null || script.points.Length == 0)
        {
            if (script.GetComponent <Collider>() != null)
            {
                EditorGUILayout.HelpBox("No points, using collider.bounds", MessageType.Info);
            }
            else if (script.GetComponent <Renderer>() != null)
            {
                EditorGUILayout.HelpBox("No points, using renderer.bounds", MessageType.Info);
            }
            else
            {
                EditorGUILayout.HelpBox("No points and no collider or renderer attached, will not affect anything\nPoints can be added using the transform tool and holding shift", MessageType.Warning);
            }
        }

        Vector3[] prePoints = script.points;

#if UNITY_4
        EditorGUILayout.PropertyField(serializedObject.FindProperty("points"), true);
        if (GUI.changed)
        {
            serializedObject.ApplyModifiedProperties();
        }
#else
        DrawDefaultInspector();
#endif

#if UNITY_LE_4_3
        EditorGUI.indentLevel = 1;
#else
        EditorGUI.indentLevel = 0;
#endif

        script.updatePhysics = EditorGUILayout.Toggle(new GUIContent("Update Physics", "Perform similar calculations on the nodes as during scan.\n" +
                                                                     "Grid Graphs will update the position of the nodes and also check walkability using collision.\nSee online documentation for more info."), script.updatePhysics);

        if (script.updatePhysics)
        {
            EditorGUI.indentLevel++;
            script.resetPenaltyOnPhysics = EditorGUILayout.Toggle(new GUIContent("Reset Penalty On Physics", "Will reset the penalty to the default value during the update."), script.resetPenaltyOnPhysics);
            EditorGUI.indentLevel--;
        }

        script.updateErosion = EditorGUILayout.Toggle(new GUIContent("Update Erosion", "Recalculate erosion for grid graphs.\nSee online documentation for more info"), script.updateErosion);

        if (prePoints != script.points)
        {
            script.RecalcConvex();
            HandleUtility.Repaint();
        }

        bool preConvex = script.convex;
        script.convex = EditorGUILayout.Toggle(new GUIContent("Convex", "Sets if only the convex hull of the points should be used or the whole polygon"), script.convex);
        if (script.convex != preConvex)
        {
            script.RecalcConvex(); HandleUtility.Repaint();
        }

        script.minBoundsHeight = EditorGUILayout.FloatField(new GUIContent("Min Bounds Height", "Defines a minimum height to be used for the bounds of the GUO.\nUseful if you define points in 2D (which would give height 0)"), script.minBoundsHeight);
        script.applyOnStart    = EditorGUILayout.Toggle("Apply On Start", script.applyOnStart);
        script.applyOnScan     = EditorGUILayout.Toggle("Apply On Scan", script.applyOnScan);

        script.modifyWalkability = EditorGUILayout.Toggle(new GUIContent("Modify walkability", "If true, walkability of all nodes will be modified"), script.modifyWalkability);
        if (script.modifyWalkability)
        {
            EditorGUI.indentLevel++;
            script.setWalkability = EditorGUILayout.Toggle(new GUIContent("Walkability", "Nodes' walkability will be set to this value"), script.setWalkability);
            EditorGUI.indentLevel--;
        }

        script.penaltyDelta = EditorGUILayout.IntField(new GUIContent("Penalty Delta", "A penalty will be added to the nodes, usually you need very large values, at least 1000-10000.\n" +
                                                                      "A higher penalty will mean that agents will try to avoid those nodes."), script.penaltyDelta);

        if (script.penaltyDelta < 0)
        {
            EditorGUILayout.HelpBox("Be careful when lowering the penalty. Negative penalties are not supported and will instead underflow and get really high.\n" +
                                    "You can set an initial penalty on graphs (see their settings) and then lower them like this to get regions which are easier to traverse.", MessageType.Warning);
        }

        script.modifyTag = EditorGUILayout.Toggle(new GUIContent("Modify Tags", "Should the tags of the nodes be modified"), script.modifyTag);
        if (script.modifyTag)
        {
            EditorGUI.indentLevel++;
            script.setTag = EditorGUILayout.Popup("Set Tag", script.setTag, AstarPath.FindTagNames());
            EditorGUI.indentLevel--;
        }

        if (GUILayout.Button("Tags can be used to restrict which units can walk on what ground. Click here for more info", "HelpBox"))
        {
            Application.OpenURL(AstarPathEditor.GetURL("tags"));
        }

        EditorGUILayout.Separator();

        bool worldSpace = EditorGUILayout.Toggle(new GUIContent("Use World Space", "Specify coordinates in world space or local space. When using local space you can move the GameObject " +
                                                                "around and the points will follow.\n" +
                                                                "Some operations, like calculating the convex hull, and snapping to Y will change axis depending on how the object is rotated if world space is not used."
                                                                ), script.useWorldSpace);
        if (worldSpace != script.useWorldSpace)
        {
#if !UNITY_LE_4_3
            Undo.RecordObject(script, "switch use-world-space");
#endif
            script.ToggleUseWorldSpace();
        }

#if UNITY_4
        EditorGUI.BeginChangeCheck();
#endif
        script.lockToY = EditorGUILayout.Toggle("Lock to Y", script.lockToY);

        if (script.lockToY)
        {
            EditorGUI.indentLevel++;
            script.lockToYValue = EditorGUILayout.FloatField("Lock to Y value", script.lockToYValue);
            EditorGUI.indentLevel--;

#if !UNITY_LE_4_3
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(script, "change Y locking");
            }
#endif
            script.LockToY();
        }

        EditorGUILayout.Separator();

        if (GUILayout.Button("Clear all points"))
        {
#if UNITY_LE_4_3
            Undo.RegisterUndo(script, "Removed All Points");
#endif
            script.points = new Vector3[0];
            EditorUtility.SetDirty(target);
            script.RecalcConvex();
        }

        if (GUI.changed)
        {
                        #if UNITY_LE_4_3
            Undo.RegisterUndo(script, "Modify Settings on GraphUpdateObject");
                        #endif
            EditorUtility.SetDirty(target);
        }
    }
Exemplo n.º 8
0
    public override void OnInspectorGUI()
    {
        GraphUpdateScene script = target as GraphUpdateScene;

        if (script.points == null)
        {
            script.points = new Vector3[0];
        }

        Vector3[] prePoints = script.points;
        DrawDefaultInspector();
        EditorGUI.indentLevel = 1;

        if (prePoints != script.points)
        {
            script.RecalcConvex(); HandleUtility.Repaint();
        }

        bool preConvex = script.convex;

        script.convex = EditorGUILayout.Toggle(new GUIContent("Convex", "Sets if only the convex hull of the points should be used or the whole polygon"), script.convex);
        if (script.convex != preConvex)
        {
            script.RecalcConvex(); HandleUtility.Repaint();
        }

        script.applyOnStart = EditorGUILayout.Toggle("Apply On Start", script.applyOnStart);
        script.applyOnScan  = EditorGUILayout.Toggle("Apply On Scan", script.applyOnScan);

        script.modifyWalkability = EditorGUILayout.Toggle("Modify walkability", script.modifyWalkability);
        if (script.modifyWalkability)
        {
            EditorGUI.indentLevel++;
            script.setWalkability = EditorGUILayout.Toggle("Walkability", script.setWalkability);
            EditorGUI.indentLevel--;
        }

        script.penalty = EditorGUILayout.IntField("Penalty", script.penalty);

#if ConfigureTagsAsMultiple
        script.modifyTag = EditorGUILayout.Toggle(new GUIContent("Modify Tags", "Should the tags of the nodes be modified"), script.modifyTag);
        EditorGUILayoutx.TagsMaskField(new GUIContent("Tags Change", "Which tags to change the value of. The values the tags will gain can be set below"), new GUIContent("Tags Set", "What to set the tag to if it is going to be changed"), ref script.tags);
#else
        script.modifyTag = EditorGUILayout.Toggle(new GUIContent("Modify Tags", "Should the tags of the nodes be modified"), script.modifyTag);
        if (script.modifyTag)
        {
            EditorGUI.indentLevel++;
            script.setTag = EditorGUILayout.Popup("Set Tag", script.setTag, AstarPath.FindTagNames());
            EditorGUI.indentLevel--;
        }
#endif

        //GUI.color = Color.red;
        if (GUILayout.Button("Tags can be used to restrict which units can walk on what ground. Click here for more info", "HelpBox"))
        {
            Application.OpenURL(AstarPathEditor.GetURL("tags"));
        }

        //GUI.color = Color.white;

        if (GUILayout.Button("Clear all points"))
        {
            Undo.RegisterUndo(script, "Removed All Points");
            script.points = new Vector3[0];
            script.RecalcConvex();
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Exemplo n.º 9
0
    public override void OnInspectorGUI()
    {
        GraphUpdateScene script = target as GraphUpdateScene;

        if (script.points == null)
        {
            script.points = new Vector3[0];
        }

        Vector3[] prePoints = script.points;
        DrawDefaultInspector();
        EditorGUI.indentLevel = 1;

        if (prePoints != script.points)
        {
            script.RecalcConvex(); HandleUtility.Repaint();
        }

        bool preConvex = script.convex;

        script.convex = EditorGUILayout.Toggle(new GUIContent("Convex", "Sets if only the convex hull of the points should be used or the whole polygon"), script.convex);
        if (script.convex != preConvex)
        {
            script.RecalcConvex(); HandleUtility.Repaint();
        }

        script.minBoundsHeight = EditorGUILayout.FloatField(new GUIContent("Min Bounds Height", "Defines a minimum height to be used for the bounds of the GUO.\nUseful if you define points in 2D (which would give height 0)"), script.minBoundsHeight);
        script.applyOnStart    = EditorGUILayout.Toggle("Apply On Start", script.applyOnStart);
        script.applyOnScan     = EditorGUILayout.Toggle("Apply On Scan", script.applyOnScan);

        script.modifyWalkability = EditorGUILayout.Toggle("Modify walkability", script.modifyWalkability);
        if (script.modifyWalkability)
        {
            EditorGUI.indentLevel++;
            script.setWalkability = EditorGUILayout.Toggle("Walkability", script.setWalkability);
            EditorGUI.indentLevel--;
        }

        script.penaltyDelta = EditorGUILayout.IntField("Penalty Delta", script.penaltyDelta);

        if (script.penaltyDelta < 0)
        {
            GUILayout.Label("Be careful when lowering the penalty. Negative penalties are not supported and will instead underflow and get really high.", "HelpBox");
        }

        bool worldSpace = EditorGUILayout.Toggle(new GUIContent("Use World Space", "Specify coordinates in world space or local space. When using local space you can move the GameObject around and the points will follow"
                                                                ), script.useWorldSpace);

        if (worldSpace != script.useWorldSpace)
        {
            script.ToggleUseWorldSpace();
        }

        script.modifyTag = EditorGUILayout.Toggle(new GUIContent("Modify Tags", "Should the tags of the nodes be modified"), script.modifyTag);
        if (script.modifyTag)
        {
            EditorGUI.indentLevel++;
            script.setTag = EditorGUILayout.Popup("Set Tag", script.setTag, AstarPath.FindTagNames());
            EditorGUI.indentLevel--;
        }

        //GUI.color = Color.red;
        if (GUILayout.Button("Tags can be used to restrict which units can walk on what ground. Click here for more info", "HelpBox"))
        {
            Application.OpenURL(AstarPathEditor.GetURL("tags"));
        }

        //GUI.color = Color.white;

        EditorGUILayout.Separator();

        //GUILayout.Space (0);
        //GUI.Toggle (r,script.lockToY,"","Button");
        script.lockToY = EditorGUILayout.Toggle("Lock to Y", script.lockToY);

        if (script.lockToY)
        {
            EditorGUI.indentLevel++;
            script.lockToYValue = EditorGUILayout.FloatField("Lock to Y value", script.lockToYValue);
            EditorGUI.indentLevel--;
            script.LockToY();
        }

        EditorGUILayout.Separator();

        if (GUI.changed)
        {
            Undo.RegisterUndo(script, "Modify Settings on GraphUpdateObject");
            EditorUtility.SetDirty(target);
        }

        if (GUILayout.Button("Clear all points"))
        {
            Undo.RegisterUndo(script, "Removed All Points");
            script.points = new Vector3[0];
            script.RecalcConvex();
        }
    }