A* Pathfinding Project  3.6.6
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
Optimization

In the pro version of the A* Pathfinding Project there is a tab called "Optimization" in the A* Inspector.

This tab searches the project for places where preprocessor directives are listed. A preprocessor directive is a piece of code which controls if another piece of code should be included in the compilation or not.

#define DEBUG
public void Start () {
#if DEBUG
Debug.Log ("The DEBUG preprocessor directive is defined");
#else
Debug.Log ("The DEBUG directive is not defined");
#endif
}

As you can see, it works like ordinary IF statements. What's good with them is that they have absolutely no runtime overhead, they are all evaluated at compile time.
The A* Pathfinding Project has some aspects of it which can be customized. It would normally require hand editing of code, but preprocessor directives solves that.
Perhaps the most useful .#define is the SingleCoreOptimize directive. If you click on the "Optimizations" tab to open it, you will see a list with all available directives. The SingleCoreOptimize directive should be listed there. Per default, the SingleCoreOptimize directive is not enabled, what is does when enabled is to restrict the number of threads pathfinding can run in to one (1), and when it is restricted to one, it can apply some memory and performance optimizations based on that. Especially memory usage can be reduced quite a lot. This directive is recommended to have enabled when deploying for mobile devices which are usually only single or dual core and are often low on available memory.

Other directives apply various other optimizations (see their respective descriptions) or enable debugging messages (though they are probably not very useful for other people than developers).

If the directives are enabled or not is stored in the source code as commented or not commented lines of #define statements which means that the settings are shared between all your scenes in your Unity project.

If you are targeting mobile you might want to reduce file size of the built player as much as possible. If so you can use the ASTAR_NO_ZIP option to remove the dependency on the DotNetZip library. After enabling the option under the optimizations panel, you may remove the dll file in Assets/AstarPathfindingProject/Plugins/DotNetZip which should cut away a few hundred kb.

There is a similar option for the JsonFx library, but the JsonFx is way smaller and currently only the NavmeshGraph will serialize settings correctly without it. So usually it is not worth it to remove it.

ASTAR_OPTIMIZE_POOLING is good to have enabled in release builds. When it is not enabled, it does some extra error checking to make sure object pooling is done correctly, but that has some performance overhead (usually very small though).

See also subpages: Pooling