Your own style
A style is a JSON file that says how the map looks: which colors, which line widths, which labels. It follows the open MapLibre style format, so you can edit it in a text editor or in Maputnik, a free visual editor. Every theme in the Worldprint window is a style.
A style is made of sources and layers. A source is where the data comes from (for a baked map, the map files in its folder). A layer picks some of that data and draws it: water in blue, buildings in grey, labels in black. Your style can change the layers freely, but it keeps the sources of the map.
Make a style
Open Window > Worldprint and bake your scene.
Pick the theme closest to what you want in Theme.
Press New Custom Style. The window copies that theme to
style-custom.json(thenstyle-custom-2.jsonand so on) in the map folder,Assets/StreamingAssets/Worldprint/<scene>/, and selects it.Edit the file in a text editor or in Maputnik. Save, then pick the style again in Theme to see the change.
The window lists every *.json style you put in the map folder under Theme, not only the ones it made.
Rebakes keep your styles. A rebake only rewrites the themes that come with the package.
When a style has a problem
A style the map cannot read, or parts it does not draw, are shown in a yellow box in the Worldprint window and
reported in the Console as Worldprint: <where>: <reason>. In code, MapView.Diagnostic gives you the same
messages (see Advanced: queries, styles and editing). The map skips what it cannot draw and shows the rest.
Use a style from code
A map set up with Add Map to Scene uses the theme you picked. To switch while the game runs, load another style
file. Paths are relative to StreamingAssets:
map.LoadStyle("Worldprint/<scene>/style-custom.json");
map.SetStyle(json, baseLocation) does the same from a string. See Advanced: queries, styles and editing.
What a baked map contains
A baked map has two sources, named in the style:
Source |
Content |
|---|---|
|
The vector data of your scene, in the layers below |
|
A picture of the relief shading, drawn over the colors |
The layers of cartograph are chosen in a style with source-layer. Each has attributes you can read in a
style to pick colors and widths.
Layer |
Shape |
Attributes |
|---|---|---|
|
areas, one per altitude band; each band covers everything above its altitude |
|
|
lines |
|
|
lines (contours lit from one side) |
|
|
areas |
|
|
areas |
|
|
areas (the outlines of Map Building) |
|
|
points (Map Tree) |
the component’s Metadata |
any other |
the Layer name of a component: points ( |
the component’s Metadata (text, number or true/false values) |
Areas appear from the zoom where they cover half a pixel. Points and lines appear at every zoom.
For example, this layer draws the forests of the map in green:
{
"id": "forest", "type": "fill", "source": "cartograph", "source-layer": "landcover",
"filter": ["==", ["get", "class"], "wood"],
"paint": { "fill-color": "#4c7a4c" }
}
Labels, fonts and icons
A Map Label component is drawn by the poi-label layer of every theme. Its text is the name attribute and
its icon is the sprite named <Icon>_11 in the bundled icon sheet (osm-bright).
A bake puts a font (fonts/Noto Sans Regular/) and the icon sheet (sprites/osm-bright) beside the styles.
The styles refer to them in their glyphs and sprite entries. A bake never overwrites a file that is already
there, so you can replace them. To use your own, in the map folder:
Font. Add
fonts/<Font name>/<first>-<last>.pbf, one file per range of 256 characters (made with a tool such asfontnikor Maputnik’s font tools). Use"text-font": ["<Font name>"]in your style.Icons. Add a sprite sheet
sprites/<name>.jsonwithsprites/<name>.png(and the@2xversions for sharp screens). Point"sprite"atsprites/<name>and use"icon-image": "<icon name>"in a layer, or["get", "icon"]to take the name from the component.
Make these changes in the style created by New Custom Style. The whole folder is in StreamingAssets, so the
fonts and icons ship with your build (see Make a player build).
What a style can use
Drawn |
Not drawn (reported as a problem when the style loads) |
|---|---|
Layer types |
Layer types |
Source types |
Dashed lines ( |
Expressions, filters and zoom-dependent values |
Sort keys ( |
Fonts and icons from your folder |
The style keys |
Anything else the map cannot draw is named in the warnings described above.