Search a route between two locations

Google API
Drawing API
Web services
Search a route between two locations and draws the route.
Usage instructions:
Add this script to map GameObject and start the scene.
Will be found the route from Los Angeles to the specified location, the drawn the line of route, and all the steps of the route will be shown in the console.
/*         INFINITY CODE         */
/*   */

using System.Collections.Generic;
using UnityEngine;

namespace InfinityCode.OnlineMapsExamples
    /// <summary>
    /// Search a route between two locations and draws the route.
    /// </summary>
    [AddComponentMenu("Infinity Code/Online Maps/Examples (API Usage)/FindDirectionExample")]
    public class FindDirectionExample : MonoBehaviour
        public string googleAPIKey;

        private void Start()
            if (string.IsNullOrEmpty(googleAPIKey)) Debug.LogWarning("Please specify Google API Key");

            // Begin to search a route from Los Angeles to the specified coordinates.
            OnlineMapsGoogleDirections request = new OnlineMapsGoogleDirections
                "Los Angeles", // FROM (string or Vector2)
                new Vector2(-118.178960f, 35.063995f) // TO (string or Vector2)

            // Specifies that search results must be sent to OnFindDirectionComplete.
            request.OnComplete += OnFindDirectionComplete;


        private void OnFindDirectionComplete(string response)
            // Get the resut object.
            OnlineMapsGoogleDirectionsResult result = OnlineMapsGoogleDirections.GetResult(response);

            // Check that the result is not null, and the number of routes is not zero.
            if (result == null || result.routes.Length == 0) 
                Debug.Log("Find direction failed");

            // Showing the console instructions for each step.
            foreach (OnlineMapsGoogleDirectionsResult.Leg leg in result.routes[0].legs)
                foreach (OnlineMapsGoogleDirectionsResult.Step step in leg.steps)

            // Create a line, on the basis of points of the route.
            OnlineMapsDrawingLine route = new OnlineMapsDrawingLine(result.routes[0].overview_polylineD,;

            // Draw the line route on the map.