A* Project with Unity iPhone

The A* Pathfinding Project works great with Unity iPhone when talking about functionality.
To get the scripts to work with Unity iPhone, basically the only thing you need to do is to delete the AstarPathEditor.cs script from your project (in the Editor folder) since Unity iPhone does not have support for custom editors, and probably won’t have until Unity 3.0 (which will be released during the summer of 2010), unfortunately that will make the editor look very messy, but it’s not much I can do about it.

You can also delete the EditorDefaultResources folder since it is only used by the A* editor scripts.
If you opened the example project with Unity iPhone (not just importing the scripts) the Standard assets folder will also have a script called DragRigidbody.js, this script will throw an error since it uses unsupported generics (I think), you can just delete that script, it isn’t needed.
Also remember that the Terrain Engine isn’t supported on the iPhone, so you can’t open the Terrain scene and expect it to work.

Here’s a comparison between the custom editor and the standard (Unity iPhone) editor, sorry for the messy look : (
Editor Comparison between regular Unity and Unity iPhone

Since it is very hard to use that editor (there are so many variables!), I strongly recommend that you set up the pathfinding in the regular Unity and then export the scene as a Unity Package, then you can open it up in Unity iPhone and the settings will still be there.
That way you can use the system in Unity iPhone but you can also get the custom inspector.

Tip: You can still scan the map in Unity iPhone by clicking “Scan Map” in the context menu (click that little gear in the top-right corner of the script).
Context Menu for A*

8 Responses to A* Project with Unity iPhone

  1. chuxiuxiang says:

    unity iphone 1.7 error
    Assets/Editor/AstarPathEditor.cs(309,30): error CS0115: `AstarPathEditor.OnInspectorGUI()’ is marked as an override but no suitable method found to override

  2. Admin says:

    Hi

    On the top of this page, it says that you have to remove AstarPathEditor.cs from the project, otherwise it won’t work in UnityIphone.

  3. chuxiuxiang says:

    Thank you, above this issue has been resolved. But then the two warning prompts do not know, will they affect?

    Couldn’t load the script “AstarClasses” because its file name doesn’t match the class name.
    Please make sure the file name of the script is the same as the class defined inside it.

    Couldn’t load the script “AstarMath” because its file name doesn’t match the class name.
    Please make sure the file name of the script is the same as the class defined inside it.

  4. Admin says:

    Good!

    Hmm, I though I had fixed that… Apparently not, only in my development version, but they won’t cause any problems, they are just a bit annoying.

  5. Mindscrye says:

    Hello!

    I was wondering if you might have a suggestion as to what I might be doing wrong. I downloaded AstarPathfinding 2.5 and ran it in Unity as per your instructions. The Terrain scene runs exactly as expected. Very cool.

    Having said that, when I try to run the same thing in Unity iPhone (except for being in Unity iPhone and having deleted the editor script) I get a series of errors. I get a BCE0019:”isKinematic” is not a member of “UnityEngine.Component” error followed by a series of errors stating that Terrain splat 0-3 are null, then a series of warnings about Texture size is not a of power two. The error list finishes off with a pair of errors stating that Blender could not be found. In the Scene edit window, I do not see any grid, textures (except on the palm trees and crates) or terrain of any kind. The white box surrounding the scene is also missing. Terrain is listed in the Hierarchy window but when highlighted and focused on in the scene window only the handle shows (no mesh or terrain of any kind). Since I don’t see anyone else complaining about this sort of behavior I have to assume that I am unwittingly doing something wrong here.

    I am planning on using your pathfinding routines in a commercial game once I figure out how to use them. Any help that you or others might offer is greatly appreciated. Thank you in advance!

    P.S. Yes, I am new to Unity so I may be doing something everyone else knows to avoid (although, as I said it runs fine in straight Unity).

  6. Admin says:

    Hi Mindscrye

    1. In the standard assets a script (DragRigidbody.js) doesn’t work very well on Unity iPhone, you have to delete that script (or change it to work) to get rid of that error, the script isn’t needed, it’s just a part of the standard assets.

    2. The Terrain splat 0-3 are null error probably comes from that the terrain engine isn’t supported on the iPhone, so any scenes using a terrain isn’t going to work.

    3. You don’t really have to care about the “Texture size is not a of power two” warnings, the textures they are referring to doesn’t use the width/height values which are power of two (i.e 2 4 8 16 32 64 128 256 512 1024 etc etc), these textures will use a bit more memory than power of two textures.

    4. There are probably .blend files in the project folder, I think I put one or two there. Unity will try to convert .blend files to .fbx files on import using blenders built-in fbx exporter, if blender is not installed on your computer, unity can’t import the files. However I don’t think I used .blend files for anything in the scenes, I just put them there as the originals and used .fbx in the scenes, but I am not 100% sure.

    5. You have to select the “A*” (or “Static”) gameObject in the scene the first time you open a scene to make the initial scan, you might have to press “Scan Map” in the context menu too.
    After you have done that you should see the white bounding box.

    Since you are new to Unity you can’t know everything, I overlooked that user could have some of these problems since they seem obvious to me who have used Unity for a couple of years, but of course I should have though of it.
    I will add this to the page.

    Hope this will help you,
    Aron

  7. Impressive place of duty – I’ve been struggling with this on behalf of roughly era and it’s impressive to go with this in a row.

  8. your idea helped me in clearing my questions…. thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>