Find a route

Show a route between two points on a map using Esri's routing service REST API.


How to use the sample

This sample uses Esri's routing service's REST API to query the closest route along the road network between two points. This service uses routing operations associated with your API Key. You can learn more about API keys and Accounts in the Mapping APIs and location services guide.

  1. Open the Routing scene.
  2. Click on the RouteManager game object under ArcGISMap in the Hierarchy window.
  3. Set your API key in the Inspector window.
  4. Click play and left click on the map twice while holding shift. (This sample is only set up to work with mouse and keyboard.)

How it works

  1. The HTTPClient is used to query the routing service's REST API.
  2. The sample makes a direct request to obtain the routing result.
  3. The Raycast is used to determine the elevation at each breadcrumb's position to account for elevation. (Mesh colliders need to be enabled in the ArcGIS Map component to use the Raycast.)
  4. Unity's Line Renderer component is used to visualize the route segments between pairs of breadcrumbs.


routing, raycast, REST API

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.