Compiler Directives
Overview of using compiler directives to optimize the package.
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 compiler directives are listed. A compiler directive is a piece of code which controls whether another piece of code should be included in the compilation or not. #define DEBUG
As you can see, it works like ordinary IF statements. The advantage of compiler directives is that they have absolutely no runtime overhead, as they are all evaluated at compile time.
public void Start () {
#if DEBUG
Debug.Log ("The DEBUG compiler directive is defined");
#else
Debug.Log ("The DEBUG directive is not defined");
#endif
}
The A* Pathfinding Project has some aspects that can be customized. This would normally require hand editing of code, but compiler directives solve that problem.
Directives apply various optimizations (see their respective descriptions) or enable debugging messages (though they are probably not very useful for people other than developers).
Whether the directives are enabled or not is stored in the player settings in the field "Scripting Define Symbols", which means that the settings are shared between all your scenes in your Unity project.
If you are targeting mobile platforms, you might want to reduce the 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 reduce the size by a few hundred kb. However, this will make the cache significantly larger when using cached startup.
This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited.
The Pro version can be bought here