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

  1. Open Window > Worldprint and bake your scene.

  2. Pick the theme closest to what you want in Theme.

  3. Press New Custom Style. The window copies that theme to style-custom.json (then style-custom-2.json and so on) in the map folder, Assets/StreamingAssets/Worldprint/<scene>/, and selects it.

  4. 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

cartograph

The vector data of your scene, in the layers below

shade-image

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

bands

areas, one per altitude band; each band covers everything above its altitude

elev (metres), rank (0 is the lowest band)

contours

lines

elev (metres), major (true on the major levels)

tanaka

lines (contours lit from one side)

major, shade (0 dark to 1 lit), w (width factor from 0 to 1)

water

areas

class: ocean, lake, river, or the class of a Map Object water area

landcover

areas

class: wood, grass, farmland, wetland, sand, rock, ice

building

areas (the outlines of Map Building)

render_height (metres) and the component’s Metadata

tree

points (Map Tree)

the component’s Metadata

any other

the Layer name of a component: points (poi), lines (line) or areas (area) by default

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 as fontnik or Maputnik’s font tools). Use "text-font": ["<Font name>"] in your style.

  • Icons. Add a sprite sheet sprites/<name>.json with sprites/<name>.png (and the @2x versions for sharp screens). Point "sprite" at sprites/<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 background, fill, line, circle, raster and symbol (text and icons)

Layer types fill-extrusion, heatmap, hillshade

Source types vector, raster, geojson and image

Dashed lines (line-dasharray), gradients and patterns (line-gradient, line-pattern, fill-pattern, background-pattern)

Expressions, filters and zoom-dependent values

Sort keys (fill-sort-key, line-sort-key, circle-sort-key): layers draw in the order of the style

Fonts and icons from your folder

The style keys terrain, sky, light, projection, transition, state

Anything else the map cannot draw is named in the warnings described above.