Author Topic: Launch World Map  (Read 185 times)

Timmy

  • Guest
Launch World Map
« on: March 23, 2020, 11:13:37 AM »
Hello,

New to Unity and coding in general.  What would be the best way to launch the minimap in full screen mode by pressing "M"?

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 5706
    • View Profile
Re: Launch World Map
« Reply #1 on: March 23, 2020, 11:28:53 AM »
Hi and welcome!

Open demo scene and take a look at the bottom/left corner of Game View. You will see some hotkeys to control the map at runtime. Those keys are just examples of how you can use scripting to open minimap, toggle full-screen mode, etc:
https://i.imgur.com/9WR28GR.png
The code behind those hotkeys is in LevelManager.cs script in the Demo/Scripts folder.

For example, show minimap in full screen mode by pressing T key, just do:

Code
if (Input.GetKeyDown (KeyCode.T)) {
    CompassNavigatorPro.CompassPro.instance.miniMapZoomState = true;
}

Normally, you would reference to the namespace CompassNavigatorPro to make code tidier:

Code
using CompassNavigatorPro;
...
CompassPro compass;
...
void Start() {
   compass = CompassPro.instance;
}
...
void Update() {
   if (Input.GetKeyDown(KeyCode.T)) {
        compass.miniMapZoomState = true;
   }
}

Just check LevelManager.cs for more API usage.