create game map (not minimap)

Hello, I'm beginner in unity and i whant to create a map for my game that indicate the player location (not minimap) and open it when click on M key ?
I hope that you give me the steps, step by step and thank you


1 Like

Well, I'd probably use a UI.Image for the map, and another UI.Image for the player marker. Set the anchor of the player marker so that it corresponds to the point on the map that corresponds to the world origin (i.e. 0,0,0 in world coordinates). Then, in code, you can just set the marker's .anchoredPosition to the position of the player (times some scaling factor).


@JoeStrout 's method is good.

Another way to do a map is to use a second camera.

  • Attach an appropriate set of symbols to every object in the world, orientate them looking upwards.
  • Put them on a layer that is not visible to the main camera.
  • Make a separate camera that looks only at the symbols layer.
  • Turn the camera on and off as appropriate.

can anyone give me a video tutorial or some codes to try
im a beginner and this is my first project

Then you shouldn't be worrying about stuff like this yet. It's definitely "intermediate" level stuff. Keep it simple — do some of the official tutorials. Then, go make a Flappy Bird or Doodle Jump clone. Then make another. Then do something else. Come back to this when the stuff we've written above doesn't sound like Greek to you!


thank you @JoeStrout i finished 80% of the game following some tutorials .then i created a minimap and a GUI that appear when the M key is pressed but i don't know how to indicate the player location in this GUI Map.

I am total begginer myself, but maybe I could help.....

It really doesnt matter if you use the UI method, or second camera... But I prefer the second camera watching some plane with map texture, it is probably more dirty method, but easier for me to comprehend.... I did this by creating some icon - sprite, or something like that. Then you add a script to it, that moves the icon...

Lets say, that you have a map, that is 10x10 units, and you world is 1000x1000 units , so the map is 100x smaller(those units are just for the example). Then the script for the movement of the icon would have the target (object the icon is representing) and then in the Update, you use something like:
transform.postion = target.transform.position / 100 ;
transform.postion.y = 0.1f; (simply some value, so the icon would be floating just above the map plane, if you use ortographic camera watching exactly from above, you wont even notice anything)

... division by 100 is because the map is actually 100 smaller than the world itself, so the icon move just like the real object on the x,z plane, only 100x less.

It is somewhat primitive, but works actually pretty well.

1 Like

I tried this and I had an Image for the map, but the Player Icon on the map always for some unknown reason, always went to the edge of the screen. I don't know why. Bu the code I has was scaling the actual Player position to the map image version, then finding the difference in the x axis and other axis then making it move the necessary steps but it went to the far left instead of moving correctly, do you know why????

You should add a collider to your icon and add walls on the edge of the map.

Kiwasi, Excellent idea. Your 2 camera method will work for me for an entirely different reason.

Can you give the video URL? Beacuse I can't find related video. thx

This code may help you

using UnityEngine.UI;
using UnityEngine;
public class EnableMap : MonoBehaviour
public RawImage map;
private bool isMapEnabled;

private void Awake()
isMapEnabled = false;
map.enabled = false;
private void Update()
if (Input.GetKeyDown(KeyCode.M))
isMapEnabled = !isMapEnabled;
private void MapEnabling()
map.enabled = isMapEnabled;

How about what is the best way to Make the Image itself without all the gizmos and crap in the editor by just screenshotting the scene top down anyone got any suggestions for that???

1 Like