A* Pathfinding Project
3.8.2
The A* Pathfinding Project for Unity 3D
|
This page is about working with the A* Pathfinding Project when deploying for iPhone/Android.
Most things here apply for both iPhone and Android. But some is only relevant for iPhone since iPhone is more restrictive and thus greater care must be taken for compatibility.
The A* Pathfinding Project works for the most part out of the box even for iPhone. But if you are using stripping (Assembly or bytecode) you will have to locate the link.xml file, which you can find at Assets/AstarPathfindingProject/link.xml and place it at Assets/link.xml. This file will instruct the AOT (ahead-of-time) compiler not to strip out the classes mentioned in the file. If you do not do this, you might get errors in some cases, for example when attempting to use caching.
Using the micro mscorlib is not supported since that strips out too much of .Net.
If you are using the Fast But No Exceptions option, you will need to enable the ASTAR_FAST_NO_EXCEPTIONS define since some reflection code cannot be used then. If you are using the pro version, simply open the Optimizations tab in the A* Inspector, enable ASTAR_FAST_NO_EXCEPTIONS and click Apply. If you are using the free version, open the AstarData.cs script (in the Core folder) and add (or uncomment) this line at the top:
Also do the same in JsonSerializer.cs.
This will hard-code references to the built-in graph types. If you have written any custom graph types you will have to add them to the hard-coded list defined in the variable DefaultGraphTypes in AstarData.cs.
Caching Startup is a good idea when deploying for the iPhone since that will reduce startup times, especially if using Recast graphs.
You can also check out the various options under A* Inspector -> Optimizations, they can help increase the performance in some cases.
Microsoft apparently thought it was a great idea to ban much of the .Net 2 API from Windows Store. So there are some extra steps that need to be taken.
First, enable ASTAR_NO_JSON and ASTAR_NO_ZIP, then delete the AstarPathfindingProject/Plugins/DotNetZip/Pathfinding.Ionic.Zip.Reduced.dll and AstarPathfindingProject/Plugins/JsonFx/Pathfinding.JsonFx.dll files. This will make the system not use zipping for compressing node data and not use json to store graph settings. This has some consequences, one of them is that updates to the A* Pathfinding System might cause the graph settings to be lost if fields have been added or removed. Graphs saved to file will also be a lot larger. After performing these steps you will need to reconfigure all your graph settings.