Increased build size and loading time

  • A* version: 5.4.6.

  • Unity version: 2022.3.62f2

  • Platforms: Android & iOS → il2cpp

Hi,

We’re investigating a regression after updating A* to 5.4.6.

What we observed on our side:

  • build size increased by roughly 4 MB, mostly in libil2cpp.so

  • loading time also increased, especially in the early startup phase

  • from our investigation, it looks like a significant part of the package code is being kept in the build even though we only use a small subset of A*

Our current understanding is that the increase is mostly code-size related, likely due to retained/generated IL2CPP code from the package structure itself, and possibly also code paths tied to Burst/Collections/ALINE, rather than from assets or runtime graph data alone.

Our actual usage of A* is quite limited:

  • GridGraph

  • Seeker

  • AstarPath.active.Scan()

  • AstarPath.active.UpdateGraphs(…)

  • AstarPath.active.GetNearest(…)

  • direct gridGraph.SetDimensions(…)

  • manual movement using path results

As far as we can tell, we do not use:

  • RecastGraph

  • NavMeshGraph

  • NavmeshCut

  • NavmeshAdd

  • PointGraph

  • LayerGridGraph

  • RVO

  • AIPath, RichAI, AILerp, FollowerEntity

  • GraphUpdateScene

  • NodeLink*

  • turn-based helpers

  • most extra modifiers

We also noticed that ALINE is pulled into runtime and seems to generate/retain additional code by itself, even though we don’t need debug drawing in player builds.

So the main question is:

Is there a safe supported way to strip or disable the unused parts of the package for a grid-only setup, including:

  • navmesh/recast-related code

  • Clipper-related code

  • RVO

  • unused controllers/components

  • ALINE / runtime drawing code

  • any other subsystems that are not needed for GridGraph + Seeker

If there is no built-in safe way to do this, could you advise what the safest approach would be on our side?
For example:

  • which folders/files can be removed safely

  • which defines can be enabled

  • whether there is a recommended way to split runtime assemblies

  • whether ALINE can be disabled entirely in player builds

  • whether Clipper/navmesh code can be excluded safely when only grid graphs are used

Any guidance on the minimal safe subset of A* for our use case would be very helpful.

Thanks

Outside of the Compiler Directives built in settings, I don’t know of any ways to strip out parts of the package from within Astar. I’ll tag Aron for more information on this one. What version of Astar are you upgrading from?

Yes, I’d recommend checking out the compiler directives. It allows you to remove some graph types completely.

You can also remove the whole example scenes folder, if you have that in your project.

Modifiers and their editor scripts should be mostly safe to remove too.

1 Like