{"id":1554,"date":"2026-09-11T23:17:26","date_gmt":"2026-09-11T23:17:26","guid":{"rendered":"https:\/\/x.sheep-mine.ts.net\/index.php\/full-unity-2d-game-tutorial-2019-making-mini-map-mask\/"},"modified":"2026-09-11T23:17:26","modified_gmt":"2026-09-11T23:17:26","slug":"full-unity-2d-game-tutorial-2019-making-mini-map-mask","status":"publish","type":"post","link":"https:\/\/x.sheep-mine.ts.net\/index.php\/full-unity-2d-game-tutorial-2019-making-mini-map-mask\/","title":{"rendered":"Full Unity 2D Game Tutorial 2019 \u2013 Making Mini Map Mask"},"content":{"rendered":"<p><br \/>\n<\/p>\n<div>\n<p class=\"dpsp-share-text \" style=\"margin-bottom:10px\">\n\t\tSharing is caring!\t<\/p>\n<h2>Full Unity 2D Game Tutorial 2019 \u2013 Making Mini Map Mask<\/h2>\n<p>In this section we will be making the mini map and then using a mask to shape our mini map into something more appealing then a big oblong on the screen.<\/p>\n<h3>Full Unity 2D Game Tutorial 2019 \u2013 Making Minor Modifications<\/h3>\n<p>Before we start with the mini map we\u2019re going to increase the size of our ships as they are quite small and can be difficult to see on smaller screens. We want this to be playable on many different screen sizes so we will make it a bit easier by doubling the ship sizes. To do that we will edit the spaceship sprite by clicking on it in the project window. Then set the pixels per unit to 64 and click apply to update the sprites.<\/p>\n<p><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1084\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-1.png\" alt=\"mini map spaceship \" width=\"380\" height=\"597\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-1.png 380w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-1-191x300.png 191w\" sizes=\"auto, (max-width: 380px) 100vw, 380px\"\/><\/a><\/p>\n<p>As soon as you have done that you will see the spaceships are double their original size. This is only the images though, the colliders are still the normal size of 0.1. So we need to edit those as well.\u00a0 Select the player object and edit the collider so it is now 0.2 radius. Which is double the previous value of 0.1. Our player is now done so lets update the enemies as well. This time we will edit the enemy prefab. That\u2019s it for the minor modifications.<\/p>\n<h3>Full Unity 2D Game Tutorial 2019 \u2013 Mini Map Camera<\/h3>\n<p>In order for us to make a mini map we need a camera which will be used to create the image used in the minimap. Think of it like a camera high in the sky over our world. Adding a camera is the same as adding any other game object. Right click in the hierarchy view and select camera and voila! we have a camera. The camera will need some adjustment to work as a minimap camera but the first thing we will do is rename it to MapCam. Then we will set its projection method to Orthographic, its size to 7 and its default color to black. Finally we update the culling mask and remove the default layer by clicking on it. This will mean our camera will ignore anything on the default layer and in our case just draw the player and enemies.<\/p>\n<p><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1086\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-3.png\" alt=\"mini map camera black\" width=\"1033\" height=\"639\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-3.png 1033w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-3-300x186.png 300w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-3-768x475.png 768w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-3-1024x633.png 1024w\" sizes=\"auto, (max-width: 1033px) 100vw, 1033px\"\/><\/a><\/p>\n<h3>Full Unity 2D Game Tutorial 2019 \u2013 Mini Map Render Texture<\/h3>\n<p>Our Camera is still working like a normal camera, we want it to render its view to an image instead of to us the player. In order to do that we first need to make a render texture. A render texture is an image which will be created only at run-time and not stored as a file and can be created by right clicking the project window and clicking create > render texture.<\/p>\n<p><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1087\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-4.png\" alt=\"mini map create render texture\" width=\"605\" height=\"816\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-4.png 605w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-4-222x300.png 222w\" sizes=\"auto, (max-width: 605px) 100vw, 605px\"\/><\/a><\/p>\n<p>Name our render texture to mpRenderTexture and drag it into our camera\u2019s target texture. Now our render texture will always contain the view from our camera and we can use this texture to display on screen with some UI elements.<\/p>\n<h3>Full Unity 2D Game Tutorial 2019 \u2013 Mini Map UI<\/h3>\n<p>To display our new mini map render texture we will be using the canvas UI. Create an empty object called MapContainer. This will be the container that holds our map and mask. Inside that create another empty called MapMask. This will be the mask which shows or hides part of our map based on the alpha value of the mask texture we will add. Create our 3rd and final empty inside the MapMask and call that MapTexture. This will display our render texture.<\/p>\n<p><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1088\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-5.png\" alt=\"mini map empty objects\" width=\"409\" height=\"307\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-5.png 409w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-5-300x225.png 300w\" sizes=\"auto, (max-width: 409px) 100vw, 409px\"\/><\/a><\/p>\n<p>Update the anchors, pos X, pos Y, width and height of our 3 new empty objects to match the images below.<\/p>\n<p><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1089\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-6.png\" alt=\"mini map container\" width=\"310\" height=\"264\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-6.png 310w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-6-300x255.png 300w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\"\/><\/a> <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1090\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-7.png\" alt=\"mini map mask\" width=\"311\" height=\"268\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-7.png 311w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-7-300x259.png 300w\" sizes=\"auto, (max-width: 311px) 100vw, 311px\"\/><\/a> <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1091\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-8.png\" alt=\"mini map texture\" width=\"309\" height=\"265\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-8.png 309w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-8-300x257.png 300w\" sizes=\"auto, (max-width: 309px) 100vw, 309px\"\/><\/a><\/p>\n<p>Now that out UI elements are positioned nicely we will add textures and masks to make them show the mini map. Add a Raw Image component to our MapTexture and set the Texture to our mpRenderTexture. You should now be able to see the mini map image captured by our camera in the scene and game view. But it\u2019s a big ugly plain rectangle.<\/p>\n<p><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1092\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-9.png\" alt=\"mini map texture raw image\" width=\"324\" height=\"380\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-9.png 324w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-9-256x300.png 256w\" sizes=\"auto, (max-width: 324px) 100vw, 324px\"\/><\/a><\/p>\n<p>Full Unity 2D Game Tutorial 2019 \u2013 Mini Map Masks and Masking<\/p>\n<p>Masking allows us to show only a portion of a texture based on the alpha value of another texture. For example we have our mini map that is a big rectangle. We could use a mask to render that rectangle as a circle by using an image of a circle surrounded by transparent pixels and applying it as a mask to our mini map texture.<\/p>\n<p><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1093\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-10.png\" alt=\"mini map mask example\" width=\"582\" height=\"165\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-10.png 582w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-10-300x85.png 300w\" sizes=\"auto, (max-width: 582px) 100vw, 582px\"\/><\/a><\/p>\n<figure id=\"attachment_1095\" class=\"thumbnail wp-caption aligncenter\" style=\"width: 202px\"><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/mapbordermask.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1095 size-full\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/mapbordermask.png\" alt=\"mini map mask\" width=\"192\" height=\"108\"\/><\/a><figcaption class=\"caption wp-caption-text\">Mini Map Mask<\/figcaption><\/figure>\n<figure id=\"attachment_1097\" class=\"thumbnail wp-caption aligncenter\" style=\"width: 202px\"><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/mapborder.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1097 size-full\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/mapborder.png\" alt=\"mini map mask border\" width=\"192\" height=\"108\"\/><\/a><figcaption class=\"caption wp-caption-text\">Mini Map Mask Border<\/figcaption><\/figure>\n<p>Unfortunately the image we will be using are plain white and will not show up very well on this site, however they have been captioned so you should be able to see where they are. Download these images(<a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/github.com\/dfour\/FU2DGameTutorial2019\/tree\/minimap\/SpaceFighterTutorial\/Assets\/Images\">or get them directly from the github repository<\/a>) as we will be using them for our masking. Now we know what masking is lets add it to our project. On our MapMask object add 2 new components. An Image component that will hold our mask image and a Mask (script) which will turn our image into a mask. Add the Mini Map Mask image we downloaded to our project by dragging it into our images folder. Now add it as our source image and set the colour to black.<\/p>\n<p><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1094\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-11.png\" alt=\"mini map mask mask object\" width=\"324\" height=\"421\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-11.png 324w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-11-231x300.png 231w\" sizes=\"auto, (max-width: 324px) 100vw, 324px\"\/><\/a><\/p>\n<p>You should new have a masked mini map and it should look something like the image below:<\/p>\n<p><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-12.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1098\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-12.png\" alt=\"mini map with mask\" width=\"508\" height=\"336\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-12.png 508w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-12-300x198.png 300w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\"\/><\/a><\/p>\n<p>This is better but it could use a border to make it stand out a bit more. On our map container add a new Image component and set the the source image to the Mini Map Mask Border image we downloaded earlier. Adjust the color to something you like. I used pure blue at 80 alpha and you should have a nice new mini map on your game.<\/p>\n<p><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-13.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1099\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-13.png\" alt=\"mini map finished\" width=\"1049\" height=\"614\" srcset=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-13.png 1049w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-13-300x176.png 300w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-13-768x450.png 768w, https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/minimapmaker-13-1024x599.png 1024w\" sizes=\"auto, (max-width: 1049px) 100vw, 1049px\"\/><\/a><\/p>\n<p>The final step is to make the camera follow the player. This is made simple by the fact we already follow the player on the main camera so all we need to do is to add the FollowPlayer script to the MapCam and drag the player object to the player object slot in our FollowPlayer script.<\/p>\n<p><a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/mmmmmmmm.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1101\" src=\"https:\/\/www.gamedevelopment.blog\/wp-content\/uploads\/2019\/01\/mmmmmmmm.gif\" alt=\"mini map mask moving gif image\" width=\"600\" height=\"338\"\/><\/a><\/p>\n<p>You should now have something similar to the image above (I scaled the map up 2x to be clearer in the image above)<\/p>\n<p>The finished source is available on <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/github.com\/dfour\/FU2DGameTutorial2019\/tree\/minimap\">github here<\/a>.<\/p>\n<p>\u00a0<\/p>\n<p>\n\t\t\t\t<span class=\"post-views-icon dashicons dashicons-chart-bar\"\/> <span class=\"post-views-label\">Views:<\/span> <span class=\"post-views-count\">18,278<\/span>\n\t\t\t<\/p>\n<p class=\"dpsp-share-text \" style=\"margin-bottom:10px\">\n\t\tSharing is caring!\t<\/p>\n<\/p><\/div>\n<p><br \/>\n<br \/><a href=\"https:\/\/www.gamedevelopment.blog\/full-unity-2d-game-tutorial-2019-making-mini-map-mask\/\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sharing is caring! Full Unity 2D Game Tutorial 2019 \u2013 Making Mini Map Mask In&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1555,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1329,997,2492,2490,2291,763,1170,2029,2699,920,2700,2491,1328,2293,2294],"tags":[683,836,2488,835,2101,2388,2285,2697,2698,841,2287,2288,2289],"class_list":["post-1554","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-2d","category-development","category-effects","category-fu2gt","category-game","category-game-development","category-gaming","category-graphics","category-image","category-life-stream","category-maps","category-tutorial","category-unity","category-unity-2019","category-unity-2d","tag-2d","tag-development","tag-effects","tag-game","tag-game-development","tag-gaming","tag-graphics","tag-image","tag-maps","tag-tutorial","tag-unity","tag-unity-2019","tag-unity-2d"],"_links":{"self":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/posts\/1554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/comments?post=1554"}],"version-history":[{"count":0,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/posts\/1554\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/media\/1555"}],"wp:attachment":[{"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/media?parent=1554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/categories?post=1554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/x.sheep-mine.ts.net\/index.php\/wp-json\/wp\/v2\/tags?post=1554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}