Hands-on Quickstart

You'll create a real-world scene in Unity, that at run-time, contains the geographic features associated with a particular set of geographic coordinates. By following this walk-through, you'll learn how to use a GameObject to base your real-world scene upon.

Assumptions

  • You already have Unity version 2017.3 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 Getting Started procedure. When you're done, you'll have downloaded the Maps Unity SDK Demo, and imported it into Unity.

Step 3: Save the scene

  1. Click File > Save Scenes.

  2. Name your scene Any Location.

Step 4: Create an empty GameObject

This GameObject will serve as the underlying GameObject for your MapsService script component. The Maps Unity SDK Demo 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 5: Add the MapsService script component

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

  1. In the Inspector, click Add Component.

  2. In the Add Component selector dialog, select Scripts > GoogleMaps > Maps Service. The Maps Service (Script) component appears beneath the Transform component.

Step 6: 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, select Scripts > Basic Example.

  3. In the Lat Lng field of the Basic Example component, enter "40.748, -73.988". This is a coordinate in the center of Manhattan, the location supported by the demo.

  4. Save the scene by clicking File > Save Scenes.

Step 7: Run the scene

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

You're done!

Send feedback about...

Google Maps Platform gaming solution
Google Maps Platform gaming solution