World Map 2D Edition · Quick Start
WorldMap2D instance (the prefab) and a Demo GameObject with a script showing how to use the asset properties from C#.
There are two ways to add the map:
| Method | Steps |
|---|---|
| Menu | Go to GameObject > 3D Object > World Map 2D Edition – Main Map |
| Prefab | Drag the WorldMap2D prefab from Resources/Prefabs into your scene |
A WorldMap2D GameObject appears in the hierarchy. Select it to view its properties in the Inspector.
To render the map inside a cropped rectangular area:
Resources/Prefabs).using WPMF;
public class MyMapScript : MonoBehaviour {
void Start() {
WorldMap2D map = WorldMap2D.instance;
// React to country clicks
map.OnCountryClick += (countryIndex, regionIndex) => {
Debug.Log("Clicked: " + map.countries[countryIndex].name);
};
// Fly to a country
int spain = map.GetCountryIndex("Spain");
if (spain >= 0) {
map.FlyToCountry(spain, 2f, 0.1f);
map.ToggleCountrySurface(spain, true, Color.yellow);
}
}
}
Help us improve this documentation page.