A* Pathfinding compatibility issues with Unity 3.2: no problemo

If you’re using A* Pathfinding project and just updated your Unity editor to the 3.2 version, you will notice 3 errors in your console that were not there before:

Assets/Editor/AstarPathEditor.cs(372,59): error CS0122: `UnityEditor.EditorStyles.notificationBackground’ is inaccessible due to its protection level

Assets/Editor/AstarPathEditor.cs(372,35): error CS1502: The best overloaded method match for `UnityEngine.GUILayout.Button(UnityEngine.GUIContent, params UnityEngine.GUILayoutOption[])’ has some invalid arguments

Assets/Editor/AstarPathEditor.cs(372,35): error CS1503: Argument `#2′ cannot convert `object’ expression to type `UnityEngine.GUILayoutOption[]’

Well, don’t panic, here is a quick fix that will save your day you some minutes^^:

In the Assets/Editor/AstarPathEditor.cs file, line 372, replace

GUILayout.Button (co,EditorStyles.notificationBackground);

by

GUILayout.Button (co);

Save the file and go back to Unity editor: simple, right? you’re welcome XD


Related posts:

7 Responses to A* Pathfinding compatibility issues with Unity 3.2: no problemo
  1. Aron Granberg Reply

    Thanks GFX47, you posted instructions before I even noticed the 3.2 update 😀

    • GFX47 Reply

      You’re welcome! It’s nothing compared to the work you’ve done on A* 😉

    • GFX47 Reply

      BTW, maybe there is a better fix which would preserve the button style you used (EditorStyles.notificationBackground)?

  2. cyangamer Reply

    Wow, thanks man! Such a simple fix!

  3. Jordan Thompson Reply

    Awesome! I can’t wait to check it out thank you!

  4. Phil Reply

    Hey, I tried your fix but I still have errors. Not sure why it seems to be working for everyone but me.

    Assets/Editor/AstarPathEditor.cs(315,108): error CS0122: `UnityEditor.EditorStyles.notificationBackground’ is inaccessible due to its protection level

    Assets/Editor/AstarPathEditor.cs(315,29): error CS1502: The best overloaded method match for `UnityEngine.GUI.Box(UnityEngine.Rect, string, UnityEngine.GUIStyle)’ has some invalid arguments

    Assets/Editor/AstarPathEditor.cs(315,29): error CS1503: Argument `#3′ cannot convert `object’ expression to type `UnityEngine.GUIStyle’

    Hopefully someone can point me in the right direction.

    Cheers

  5. GFX47 Reply

    It’s odd because here is what I have in my Assets/Editor/AstarPathEditor.cs file, around the line #315:

    Vector2 arrayPos = HandleUtility.WorldToGUIPoint (new Vector3 (minNode.pos.x*path.grids[minNode.pos.y].nodeSize, minNode.vectorPos.y, minNode.pos.z*path.grids[minNode.pos.y].nodeSize));
    GUI.depth = 100;
    GUI.Box (new Rect (arrayPos.x-6,arrayPos.y-6,12,12),””);
    GUI.depth = 0; // line #315
    Handles.EndGUI ();

    Maybe you are using a different version of the A*Pathfinding plugin?

    Anyway the problem looks the same so you should simply remove the EditorStyles.notificationBackground reference.
    See this for more details on the GUI.Box method: http://unity3d.com/support/documentation/ScriptReference/GUI.Box.html

    Hope this will help!

Leave a Reply

Your email address will not be published. Please enter your name, email and a comment.