Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Creating a Basic Rounded MiniMap in Unity

Discussion in 'Community Learning & Teaching' started by stridervan, Nov 11, 2011.

  1. stridervan

    stridervan

    Joined:
    Nov 11, 2011
    Posts:
    141
    This my first tutorial video on how to create a basic minimap in unity. This is not the very optimized minimap for large scale maps but good for smaller ones and can

    Part1


    Part2
     
    Last edited: Apr 6, 2013
  2. jtadeo1

    jtadeo1

    Joined:
    Oct 18, 2006
    Posts:
    78
    This looks really useful. Thanks for the post.
     
  3. roxxyane

    roxxyane

    Joined:
    Nov 30, 2011
    Posts:
    20
    I have an error when using your GUIManager script

    "Unexpected Symbol ' } ' "
    "Parsing Error"

    Do you mind to check my code below?

    using UnityEngine;

    public class GUIManager : MonoBehaviour
    {
    public RenderTexture MiniMapTexture;
    public Material MiniMapMaterial;

    private float offset;

    void Awake () {

    offset = 10;
    }


    void OnGUI (){
    if(Event.current.type == EventType.Repaint){
    Graphics.DrawTexture(new Rect( Screen.width - 256 - offset, offset,256,256), MiniMapTexture,MiniMapMaterial);l
    }
    }
    }
     
  4. Stefano_1990

    Stefano_1990

    Joined:
    Oct 10, 2011
    Posts:
    278
    See red and bold.
     
  5. roxxyane

    roxxyane

    Joined:
    Nov 30, 2011
    Posts:
    20
    haha.. thanx.. simple mistake..

    by the way, my minimap work fine just now, do anyone here have any reference or tutorial of using a pre-textured map.
    My plan is instead of using render to texture stlye, i want to load my own map for the minimap. Any idea?
     
  6. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Roxxyane: Welcome to the Unity Forums! I see that you've found the teaching section. This is GREAT! If you need specific answers, try the Custom Search Engine listed in my signature. This is good as it is better than the forum search engine and includes other sites like the Wiki and Unity Answers.

    Also: When posting code, don't forge the "code tags": They will help make your code more readable:

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class GUIManager : MonoBehaviour
    4. {
    5.     public RenderTexture MiniMapTexture;
    6.     public Material MiniMapMaterial;
    7.    
    8.     private float offset;
    9.    
    10.     void Awake () {
    11.        
    12.         offset = 10;
    13.     }
    14.      
    15.    
    16.     void OnGUI (){
    17.             if(Event.current.type == EventType.Repaint){
    18.                 Graphics.DrawTexture(new Rect( Screen.width - 256 - offset, offset,256,256), MiniMapTexture,MiniMapMaterial);l
    19.             }
    20.     }
    21.        
    22.            
    23.  
    24.  
    25. }
     
  7. stridervan

    stridervan

    Joined:
    Nov 11, 2011
    Posts:
    141
    @roxxyane Sorry roxxayne, couldnt read your 1st question since no one really seemed interested in commenting on my tutorial I simply abandoned checking this thread. But felt like checking it today and saw ur problem got solved :p

    And yes of course, you can use your own map texture, this is easier than the the tutorial version. You can simply use a 2D Texture.(If the texture is too large, you can stream texture info(pixels) using a second "thread" to handle the calculations aside from the unity main thread :). Or you can simply break your maps in small pieces and store it inside an array or list or in a database and load them at run time based on where the player is standing and draw the appropriate textures instead of the render texture.

    I'm sure the 1st method requires little work(if you already knew threading, won't be that hard), but the second method wouldnt require that much work compared to the 1st one. I'll let you know if I figure out any other alternatives, gl
     
    Last edited: Dec 11, 2011
  8. roxxyane

    roxxyane

    Joined:
    Nov 30, 2011
    Posts:
    20
    Thanx everybody.. feels like a home here..
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's a home but there's funny people who drill holes in walls just to peep at you during quiet moments.
     
  10. stridervan

    stridervan

    Joined:
    Nov 11, 2011
    Posts:
    141
  11. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Fantastic! Thanks for sharing!
     
  12. humam

    humam

    Joined:
    Sep 2, 2013
    Posts:
    3
    its a very good tutorial... but i want to make my mini map a transparent one for a racing game what i want is a translucent minimap with transparent background and only showing the track and pointers...
     
  13. harukasong

    harukasong

    Joined:
    Dec 16, 2018
    Posts:
    1
    Hi! I used Pro Radar Builder in Unity that can create

    - 2D & 3D radars and tracking systems.

    - Static minimaps, ideal for small static scenes.

    - Realtime Minimap , ideal for large scenes / Open worlds.

    - Advanced rotation re-targeting.

    and also offers lots free templates to beautify your radars.
    The System Uses Neither Unity UI nor IMGU, making it fast and no coding is needed. It’s awesome.