Search Unity

Interactive 2D World Map

Discussion in 'Getting Started' started by DiogoCosta, Feb 16, 2015.

  1. DiogoCosta

    DiogoCosta

    Joined:
    Feb 15, 2015
    Posts:
    12
    I'm fairly new to Unity and I would like to know if there is a way to create an interactive 2D world map in Unity. I need to have a map with clickable regions and that I will be able to zoom onto different regions. Can anyone help?
     
  2. Makaveli702

    Makaveli702

    Joined:
    May 7, 2013
    Posts:
    7
    Well at least i'm not alone. I have been searching for the same answer. So i'm go ahead and bump this so hopefully we both can get an answer.
     
  3. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    It's easiest with sprites. Map background, region sprites + highlighted versions. Move the camera to centre on the region in question as needed, and change orthographic size to zoom.
     
  4. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    One common trick for irregular shaped regions is to have another texture in plain colours that you can read the pixels off to determine the country selected.
     
  5. Makaveli702

    Makaveli702

    Joined:
    May 7, 2013
    Posts:
    7
    How are you going to detect the region you have selected? with raycast hit?
     
  6. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Raycast doesn't often make sense for a 2D map. Instead you can translate the screen position to a world position directly.
     
  7. MatiasWainstein

    MatiasWainstein

    Joined:
    Feb 14, 2018
    Posts:
    3