Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: nalincy
« on: May 09, 2019, 01:38:24 PM »

Thanks a lot for the confirmation and code snippet. I move forward to use it.
Posted by: Kronnect
« on: May 08, 2019, 02:55:30 PM »

Hi, yes it's possible to achieve that with the Lite edition as well.

Attach this script to any gameobject in the scene with the map (you can create a new empty gameobject and attach this script):

Code
using UnityEngine;
using WPMF;

public class CountryColors : MonoBehaviour {

    WorldMap2D map;

    void Start() {

        map = WorldMap2D.instance;

map.enableCountryHighlight = false;
map.ToggleCountrySurface ("France", true, Color.yellow);
map.ToggleCountrySurface ("China", true, Color.red);

    }
}

The script does the following:

1) It gets a reference to the map API.
2) It disables country highlighting with mouse.
3) It colors France in yellow and China in red.

You'll notice that French Guayana is also colored in yellow. That's because the method ToggleCountrySurface affects all land regions belonging to the given country. If you just want to color the main region of the country use ToggleMainRegionSurface instead. This method is a bit more complex because it accepts more options. So instead of the ToggleCountrySurface("France"...) line, use:

Code
...
int countryIndex = map.GetCountryIndex ("France");
map.ToggleCountryMainRegionSurface(countryIndex, true, Color.yellow, null, Vector2.zero, Vector2.zero, 0);
...

Regards.
Posted by: nalincy
« on: May 08, 2019, 02:26:40 PM »

Hello!

I am new to unity. I want to show the world map in a scene with certain countries (known to game) highlighted with a specific color.

I want to know if this is possible with World Map 2D Lite Edition. In the demo of World Map 2D Lite Edition, I see that mouse movement shows the country highlighted with configured color. I want disable this behavior. I want more of a static view. Just to highlight certain countries (down the line certain cities) which are known to game at a given point of time. Is it possible with World Map 2D Lite Edition?