-
Notifications
You must be signed in to change notification settings - Fork 127
Getting Started
Maps SDK, a Microsoft Garage project, is ending. As of February 22, 2024, the SDK is deprecated. The SDK will be available until June 30, 2024, and the service will shut down March 1, 2025. Our team learned a lot during this experiment, and we appreciate the community's involvement with this Microsoft Garage project.
Windows 10 FCU | Unity 2019.3+ | Visual Studio |
---|---|---|
To develop apps for mixed reality headsets, you need the Windows 10 Fall Creators Update or newer | Check the Unity Support Matrix for a list of supported Unity versions | Visual Studio is used for code editing, deploying and building UWP app packages |
-
Sign-in to the Bing Maps Dev Center.
-
Select My keys under My Account, and select the option to create a new key.
-
Provide the following required information to create a key:
- Application name: The name of the application.
- Key type: Basic or Enterprise. Key types are explained here.
- Application type: Select Other Public Mobile App.
-
Click the Create button to get akey.
For more information about how developer key usage is accounted, see Understanding Bing Maps Transactions.
-
Option 1: Use the Sample Project.
The sample project provides a good starting point. It is configured to use the latest version of the SDK, a snapshot of MRTK, and a collection of sample scenes.
- Clone the repository
- After cloning, use Unity Hub to open the
SampleProject
folder. - Once the project has opened, follow the instructions to provide the developer key.
-
This requires modifying Unity's package manifest to include a reference to the SDK package.
-
Locate the Unity project's folder.
In the
Packages
directory, openmanifest.json
.Append the
scopedRegistries
section to the beginning of the manifest and modifydependencies
as follows:{ "scopedRegistries": [ { "name": "Maps SDK for Unity", "url": "https://unity.virtualearth.net/npm/registry/", "scopes": [ "com.microsoft.maps" ] } ], "dependencies": { "com.microsoft.maps.unity": "0.11.2", <NOTE: Existing dependencies should not be modified.> } }
-
Return to the Unity Editor; A dialog should appear showing the progress of importing the new package.
-
(Optional) If the project targets the universal render pipeline (URP), install the support package.
-
- Add a new GameObject to the Scene.
- Add a MapRenderer component to the GameObject:
Add component
->Scripts
->Microsoft.Maps.Unity
->MapRenderer
5. Provide a Bing Maps develper key
After creating a Bing Maps key, it needs to be provided to the map.
-
- In the
Assets
directory of the project, create a directory namedResources
. - In the
Resources
directory, create a file namedMapSessionConfig.txt
. - Copy the developer key into
MapSessionConfig.txt
. - Finally, ignore this file from source control e.g., add
MapSessionConfig.txt
to gitignore.
- In the
-
- Set the
MapSession
key source toDo Not Save
. - Using a custom script, load the key how you chose e.g., setup an Azure Function to retrieve the key, as explained in this blog post.
- Set the key on the
MapSession.DeveloperKey
property.
- Set the
Check out Configuring the MapRenderer for more details on the various map visualization options.
- Configuring the map
- Attaching GameObjects
- Adding labels
- Animating the map
- Raycasting the map
- Displaying copyrights
- Customizing map data
- Displaying contour lines
- Microsoft.Geospatial
- Microsoft.Geospatial.VectorMath
-
Microsoft.Maps.Unity
- ClippingVolumeDistanceTextureResolution
- ClusterMapPin
- CoordinateClamping
- DefaultElevationTileLayer
- DefaultTextureTileLayer
- DefaultTrafficTextureTileLayer
- ElevationTile
- ElevationTileLayer
- ElevationTileLayerList
- FontStyle
- FontWeight
- HttpTextureTileLayer
- IMapSceneAnimationController
- Intersection
- IntersectionType
- IPinnable
- LanguageChangedEvent
- LatLonAltUnityEvent
- LatLonUnityEvent
- LatLonWrapper
- MapColliderType
- MapConstants
- MapContourLineLayer
- MapCopyrightAlignment
- MapCopyrightLayer
- MapDataCache
- MapDataCacheBase
- MapDeveloperKeySource
- MapImageryStyle
- MapImageryType
- MapInteractionController
- MapInteractionHandler
- MapLabel
- MapLabelLayer
- MapLayer
- MapMouseInteractionHandler
- MapPin
- MapPinLayer
- MapRenderer
- MapRendererBase
- MapRendererRaycastHit
- MapRendererTransformExtensions
- MapScaleRatioExtensions
- MapScene
- MapSceneAnimationController
- MapSceneAnimationKind
- MapSceneOfBoundingBox
- MapSceneOfLabelAndZoomLevel
- MapSceneOfLocationAndZoomLevel
- MapSession
- MapShape
- MapTerrainType
- MapTouchInteractionHandler
- ObservableList
- ObservableMapPinList
- ServiceOptions
- Style
- SystemLangaugeConverter
- TextureTile
- TextureTileLayer
- TextureTileLayerList
- TileLayer
- TileLayerList
- UnityTaskFactory
- UnityWebRequestAwaiter
- UnityWebRequestAwaiterExtensionMethods
- WaitForMapLoaded
- WaitForMapSceneAnimation
- Microsoft.Maps.Unity.Search