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

Hands-on Quickstart

You'll create a scene in Unity that loads real world features from a particular location—in this case around the Statue of Liberty.

You'll see how to use a GameObject as an anchor for your real-world scene; and also, how to provide new coordinates—to generate another real-world scene.

Assumptions

  • You already have Unity version 2018.4 or later, and you currently have it running in front of you.

Step 1: Create a new project

  1. In Unity, click File > New Project....
  2. Name your project quickstart, and then click Create project.
    The Unity IDE appears with a default scene selected in the Hierarchy pane.

Step 2: Import the SDK

Follow the Install the Maps SDK for Unity SDK procedure. When you're done, you'll have created an API key, downloaded the SDK and imported it into Unity.

Step 3: Create an empty GameObject

This GameObject will serve as the underlying GameObject for your MapsService script component. The Maps SDK for Unity will then add generated geographic feature GameObjects as children of this GameObject.

  1. In the Hierarchy pane, click the Create drop-down, and then select Create Empty.

  2. Change the name of the new GameObject to Map Base.

Step 4: Add the MapsService script component

The MapsService script component is the entry point into the Maps SDK for Unity. With the Map Base GameObject selected in the Hierarchy:

  1. In the Inspector, click Add Component.

  2. In the Add Component selector dialog, search for and select Maps Service. The Maps Service (Script) component appears beneath the Transform component.

  3. In the Maps Service component, paste your API key into the API Key field.

Step 5: Add the Basic Example script component

This script sets the coordinates for the real-world location to be loaded into the scene, gets the MapService component, then uses it to initialize the floating origin, and finally loads the map with default options.

  1. With the Map Base GameObject selected in the Hierarchy; in the Inspector, click Add Component.

  2. In the Add Component selector dialog, search for and select Basic Example.

  3. Save the scene by clicking File > Save.

Step 6: Run the scene

  • Click the Play button. A scene that contains the Statue of Liberty appears in both the Scene pane, and in the Game pane.

You're done!