Build a UI Mini-Map in Unity

Joseph Hibbs
2 min readSep 24, 2023

--

Creating a simple Mini-Map in Unity can be easy, and I am here to show you how.

First, we need 4 UI Elements.

Within a empty game object which we called Map. We will create a child call Image mask and set it Rect to top right corner and give it a Mask Component and uncheck show mask graphic.

Then we will give that a Child Object called Image Map, in which we just add whatever image we want to use as a map.

Then we will give that child a child, and call it Image Enemy, and set the color to red. We then need to select the Image Mask, Image Map, and Image Enemy and make sure the pivot points for them all are at 0.5.

Now like the Image for Enemy we can do the same for player except as a child of the game object just called map and change the color to blue, and make sure the pivot point is 0.5

Now we will make a simple script to control everything.

We set the map position rect transform local position since it's a child and we only want to move its position and not the parents to the player’s X and Z position. Then we set the enemy rect transform local position to the enemy X and Z position.

--

--