Get Up and Running with the Maps SDK for Unity

Wondering how to make a map in Unity? The Maps SDK is a great place to start! The Maps SDK is a map control for Unity that allows us to utilize Bing Maps 3D Data in Unity-Based, mixed reality experiences. Here is a quick start guide on setting up the Maps SDK control and demoing the packaged samples.

Before you begin working in Unity, you need to install the required software, obtain a Bing Maps Key and create a UnityID.

Creating a Bing Maps API key is free and the whole process takes just a few minutes. If you’re looking to use the API on a small scale or just trying it out, the basic key is free of cost and gives you access to useful features like reverse geocoding and customizable map styles. Developers working on apps that call for a high number of annual cumulative transactions will find the Enterprise key more suitable.

Preparing Unity and the Maps SDK

Software Installation:

  1. Windows 10 Fall Creators Update or newer
  2. Unity 3D (supported versions: https://github.com/microsoft/MapsSDK-Unity/wiki/Unity-Support-Matrix) You can also utilize Unity Hub to target specific Unity editor versions for specific releases.
  3. Visual Studio 2017+

You can obtain your Bing Maps Key by following the instructions in the Getting a Bing Maps Key page. You can create your UnityID by registering it.

Once you have completed the required installations, obtained a Bing Maps Key and created your UnityID, you will need to download the Unity Asset Package for the Maps SDK.You are now ready to set up the Unity Project.  Here's how to make a map by importing the MapsSDK for Unity in 5 easy steps.

  1. Open Unity3D and use your UnityID to log in.
  2. Select the "New" Icon to create a new Unity Project.
  3. Once your Unity Project loads, select from the menu bar Assets > Import Package > Custom Package and select the Unity Asset Package for the Maps SDK we downloaded earlier.
    importing unity package for maps sdk
  4. You will be prompted to import the package. Click Import.
    microsoft maps unity package
  5. The Maps SDK Unity Package should now be fully loaded into your project.

In the Unity Editor, find the Project Explorer. Here you will see all the files inside of your project. By expanding the Assets folder, you will see all the contents of the package necessary to get running with the Maps SDK within Unity.

maps sdk unity assets

How to make a Unity Map Scene

To begin, you will have to create a Unity Scene. Go to File > New Scene. This should create an untitled scene. Inside the Hierarchy, you should see only two game objects: Main Camera and Directional Light.

creating new scene for maps sdk in unity

To create the map, you must create an empty 'GameObject'. Right Click anywhere inside the hierarchy and select 'Create Empty' or click Game Object > Create Empty from the top menu bar.

creating empty unity object to render a map Selected

You should now see a new 'GameObject' in your hierarchy. Feel free to rename this gameobject by right clicking it in the hierarchy and selecting rename.

empty gameobject in unity hierarchy

The next step is to add a MapRenderer component to our empty 'GameObject'. Do so by selecting the GameObject. This will bring up the GameObject's components in the Unity Inspector window. In the inspector, click Add Component > Scripts > Microsoft.Maps.Unity > Map Renderer.

adding map renderer to unity gameobject

The Unity Inspector window should now display the Map Renderer. The Map Renderer will have several fields and options. You can read more about configuring the MapRenderer here. For now, under API Settings, input your Bing Maps Key to enable the map.

map renderer in unity inspector window

Once the key is validated, you should now see Bing Maps overlaid on your GameObject.

bing maps overlaid on unity gameobject

Now you are ready to begin adding other GameObjects, labels and animations to the map! Make sure to visit the Maps SDK Wiki for the full SDK reference and additional tutorials.

Demoing the Sample Projects

In the Project Explorer, expand the Assets folder. Inside, open the Microsoft.Maps.Unity.Examples folder. You should know see three sample folders:

  1. City Tour Example
  2. Map Pin Example
  3. Weather Cube Example

Maps SDK for Unity - Assets Folder

Simply open the scene inside the sample folder to load the desired sample. Keep in mind that you will need to provide your Bing Maps key in the Map Renderer Component in the 'Map' GameObject.
 

Explore an Interactive Map SDK

Unity is a great tool for when you need to build dedicated map apps that require the flexibility of custom 3D models and animations, but other scenarios like web mapping require a different set of tools entirely. The V8 Interactive SDK is a great way to get acquainted with Bing Maps API and all that it brings to the table for web developers.

Pick up new skills with interactive code samples and a powerful code editor packed with developer-friendly features like intellisense. Developers with little experience can quickly become adept at manipulating Bing Maps API features such as data visualization and spatial data services. 

Discover a Bing Maps API license that suits your unique needs and innovate with powerful 3D Unity apps right away.

For more detailed information about the Maps SDK sample projects visit here.

- Bing Maps Team

 

Share on twitter Share on facebook Share on linkedin Share on linkedin