メインコンテンツまでスキップ

Custom map styles in Unity

前提条件
Familiarity with 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:

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

arrow-right

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:

  1. Visit mapbox.com/designer-maps.
  2. Find the Whaam! style and click Add this style.
  3. 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:

  1. Find the style on your Styles page.
  2. Click on the Menu menu next to the style name to uncover options for altering and using that style.
  3. Find the Style URL. You can use the clipboard 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.

Final product

When you run your scene with the new style, you'll see how your map has changed.

Next steps

There are many other ways for you to customize your Unity application. Explore the following resources to continue building your application:

  • Create your own custom map style in the Mapbox Studio style editor following the Create a custom style tutorial.
  • Work through our Unity tutorial series to learn how to create 3D buildings and style those building in a Unity application.
  • Try out other designer styles to find the right one for your project.
このpageは役に立ちましたか?