Custom map styles in Unity
Mapbox allows you to create completely custom maps that can be used across platforms. This tutorial will walk you through how to add a Mapbox designer map to your account as a custom style and use that custom style with the Mapbox Maps SDK for Unity.
Getting started
Here are some resources you'll need to get started:
- Mapbox account and access token. Sign up for an account at mapbox.com/signup. You can find your access tokens on your Account page.
- A Unity scene including the Mapbox Maps SDK for Unity. You can follow our tutorial, Create a map in Unity, to add a map to a scene in Unity.
- Style URL. You will use the style URL associated with your custom style to add the style to your Unity project.
Learn about map styles
A map style is a document that defines the visual appearance of a map. The style document states which data sources to use and creates style layers that specify how that data should be styled. With the Mapbox Maps SDK for Unity, you can use one of our core Mapbox styles (like Mapbox Streets, Mapbox Outdoors, and Mapbox Satellite) or a custom map style from your Mapbox account.
You can create a custom style in the Mapbox Studio style editor. For more information on creating custom styles, explore the following resources:
- Our Create a custom style tutorial.
- The Styles section of the Mapbox Studio manual.
- Our Map design guide.
You can also add one of our designer map styles to your account and use it in your Unity application. In this tutorial, you'll use the designer map style, Whaam!
Browse all designer maps and add them to your account
Add a designer style to your account
Start by signing into your Mapbox account. Once you are signed in, visit the designer map page to add a new style to your account:
- Visit mapbox.com/designer-maps.
- Find the Whaam! style and click Add this style.
- The style will automatically be added to your Mapbox account.
When the style is added to your account, it will appear on the Styles page in Mapbox Studio. From here, you can find the style URL for the style. You'll use the style URL to add this style to your Unity application:
- Find the style on your Styles page.
- Click on the Menu next to the style name to uncover options for altering and using that style.
- Find the Style URL. You can use the clipboard icon to copy the style URL, which you'll paste into your Unity project in a later step.
Add a custom style in Unity
Next, you'll add this style in Unity using the style URL.
Set up a map in Unity
First, you'll need to set up a new scene displaying a map. You can follow our tutorial for how to add a map in Unity. After completing the tutorial, you should see a map using a default Mapbox style within the Unity interface.
Change the map style in Unity
Next, change the style of the map. In Unity, open the inspector window of your Map object. Look for the IMAGES section of the Abstract Map
component. Change the Style Name to Custom. Copy and paste the style URL from the Mapbox Studio Styles page into the Map Id field.