Navigation is usually one of the first things to show up in a mobile profiler once you have more than a handful of agents.
Do not recalculate every frame. Most agents do not need a new path 60 times a second. Recalculate when the destination changes meaningfully, when the path is blocked, or on a timer of a few hundred milliseconds. Stagger those timers across agents so they do not all recalculate on the same frame.
Spread the work. If twenty agents need a path after a spawn, spreading the requests over several frames removes the spike entirely, and nobody notices a fraction of a second of delay.
Simplify the mesh. A navmesh baked at fine resolution over a big level produces far more nodes than the search needs. Coarser settings and fewer, larger walkable areas make every query cheaper. You rarely need centimetre precision to walk across a room.
Most agents do not need real pathfinding. Something that only walks between fixed points can follow a spline or a waypoint list for almost nothing. Reserve real searches for agents that genuinely need to react to a changing world.
Watch avoidance separately. Local avoidance between crowded agents can cost more than the pathfinding, and it is a different setting. If your profiler shows the cost scaling with how close agents are to each other rather than with path length, that is where to look.
Distance cull the thinking, not just the rendering. An agent behind the player, out of sight, can update far less often. Tiered update rates by distance are one of the biggest easy wins.
Where is your time going: path queries, avoidance, or the agent logic around them? The profiler separates all three, and the fix is different for each.
Do not recalculate every frame. Most agents do not need a new path 60 times a second. Recalculate when the destination changes meaningfully, when the path is blocked, or on a timer of a few hundred milliseconds. Stagger those timers across agents so they do not all recalculate on the same frame.
Spread the work. If twenty agents need a path after a spawn, spreading the requests over several frames removes the spike entirely, and nobody notices a fraction of a second of delay.
Simplify the mesh. A navmesh baked at fine resolution over a big level produces far more nodes than the search needs. Coarser settings and fewer, larger walkable areas make every query cheaper. You rarely need centimetre precision to walk across a room.
Most agents do not need real pathfinding. Something that only walks between fixed points can follow a spline or a waypoint list for almost nothing. Reserve real searches for agents that genuinely need to react to a changing world.
Watch avoidance separately. Local avoidance between crowded agents can cost more than the pathfinding, and it is a different setting. If your profiler shows the cost scaling with how close agents are to each other rather than with path length, that is where to look.
Distance cull the thinking, not just the rendering. An agent behind the player, out of sight, can update far less often. Tiered update rates by distance are one of the biggest easy wins.
Where is your time going: path queries, avoidance, or the agent logic around them? The profiler separates all three, and the fix is different for each.