It's the 15th anniversary of Google Maps Platform - Check out the latest news and announcements

Client-side Pathfinding

Unity provides systems that facilitate path-finding in your game world. For example, the NavMesh system allows you to create agents that can find their way between points in your game world.

The Client-side Road Network Pathfinding system in the Maps SDK for Unity is designed to provide similar facilities on the road network of the dynamically loaded map. It provides methods for calculating the shortest path between two intersections in a representation of the road network of the currently loaded map region (the RoadLattice).

Example usage scenario

In a hypothetical game in which players play the part of a celebrity trying to avoid paparazzi you could use the Client-side Road Network Pathfinding system to periodically update the shortest road path between each paparazzo and the current player location.

The Client-side Road Network Pathfinding system allows you to code non-player character behaviors similar to those that you can build for static, hand-crafted game levels using Unity’s features such as NavMesh .

Client-side pathfinding doesn't provide the degree of accuracy required for driving navigation in the real world. Client-side pathfinding provides an approximation that's good enough for routing dynamic game agents. For example, client-side pathfinding doesn't respect real-world properties, such as one-way streets.

The Maps SDK for Unity includes some example scenes that demonstrate how to do path finding using the Client-side Road Network Pathfinding system. You can find these scenes in Unity's Project pane, inside the Assets > GoogleMaps > Examples folder.

The APIs

To support client-side pathfinding the Maps SDK for Unity provides:

  • Two new classes: RoadLattice and RoadLatticeNode.
  • An event fired when the RoadLattice is updated.

RoadLattice class

Encapsulates the road lattice (or node graph), which represents the road network of the currently loaded map region. This is updated, and an event is fired, when parts of the map are loaded and unloaded.

RoadLatticeNode class

Encapsulates a node in a road lattice, storing location and links to neighboring nodes.


Informs you that the current road lattice just changed. It fires whenever map parts load and unload (which may happen continually as the player roams around your game world).