skip to Main Content

Using the Viewport Feature

The asset allows to render the map inside a Viewport game object. The benefits for doing this is to allow cropping the map inside the rectangle defined by the viewport gameobject area when panning or zoomin in.

To use the viewport feature:

  • Select the top menu GameObject / 3D Object / World Map 2D Edition – Viewport to create a new Viewport gameobject in the scene (you can also drag & drop the prefab from Resources/Prefabs).
  • Assign the new viewport gameobject in the scene to the viewport property of the WorldMap in the inspector (you can also do that using code, check the demo.cs script for example)
  • That’s all! The map will show up inside the viewport.

To deactivate the viewport:

  • Select the viewport field in the inspector of WorldMap component and click delete (basically, remove the reference to the viewport game object).
  • Delete the viewport game object from the scene.

The demo scene includes sample code illustrating the use of viewport using code (see demo.cs). Here’s a video of the feature in action:

Viewport Navigation Demo

Back To Top