Quick Start - How to Create a Map

MMM is strongly focused on being simple to use, you can get a map going very quickly with only a few steps, here's how...

Setting up the Map

 

Add the Map Manager

Start by adding a MapManager component. This is the key component that links the Map pieces to the Player, UI, and so on.

1. Create a new GameObject.

2. Add the MapManager component.

3. Set a grid size.

Grid size is a measure in world units. A room can, at its smallest, be 1x1 multiplied by the grid size. If your world was made up of rooms 5x5 world units in size then you could use a grid size of 5. If your rooms can be 2.5, 3.0, 4.5, 6.0 or 10.0 you might use (for example) a grid size of 0.5.

4. Set a Player GameObject or a Find Player By Tag tag.

 

Add the MapRooms

MapRooms are used to define the individual rooms. You will add one for each room in your level. MapRooms may be on the same GameObject as your level geometry (handy if you are moving things around) but can also be on a separate GameObject.

1. Add a new GameObject or select a GameObject from your exiting level geometry.

2. Add the MapRoom component to the new or selected GameObject.

3. Use the sliders to adjust the room width and room height to match your level geometry.

For example if your grid size is 2 and your room is 4.0 x 6.0 then your room size would be width 2 and height 3.

If you have the MapRoom gizmo turned on (see screenshot) then the rooms will be shown in the scene view as a translucent cube.

4. You can optional pick an override colour and override sprite for your room. Depending on Map UI settings these will be shown on the map display.

Other options are explained in the MapRoom article in the Components section of the manual.

Repeat steps 1-4 for each room in your game.

 

Setting up the UI

The UI for the map is created by the component UIMapContent.

1. Create or select your UI Canvas.

2. Create a child GameObject to use for your map.

3. Add the UIMapContent component to this GameObject.

4. Size and position the Map. You may want to add an Image component to use as the background for the map.

If you press Play you should see that the (rudimentary) map becomes visible as your Player GameObject enters each room. Color and sprites will be picked up from the MapRoom, and if none are set a blank image will be used.

5. Use the Map Scale to control the size of the objects in the map and the Room Offset to control the relationship between world position 0,0 and UI position 0,0.

For example if you map is appearing too far to the left of screen you may want to set a Room Offset of (10,0,0).

 

Structuring the UI

In order to provide more control over visibility and map layout we will generally create a GameObject to hold the visible content. The individual Map pieces will be created as children of the Visible Content GameObject.

1. Create an empty child GameObject underneath your UIMapContent GameObject.

2. Assign this new GameObject to the Visible Content field of the UIMapContent component.

 

Next Steps

Adding a Current Room Indicator

Using Prefabs

ScrollingMap

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk