Programming Guide
intermediate scriptingWorld Map Globe Edition · Scripting Support (C#)
WorldMapGlobe component (namespace WPM). Access via WorldMapGlobe.instance.
Demo folder for practical examples.
Getting Started
Add using WPM; at the top of your script. Access the globe singleton with:
using WPM;
WorldMapGlobe map = WorldMapGlobe.instance;
Namespace & Main Class
All Globe Edition classes reside in the WPM namespace.
static WorldMapGlobe instance { get; }Returns the singleton instance. One globe per scene.
Key Data Types
Country entity with name, continent, regions (List<Region>), provinces, fipsCode, isoA2, isoA3, isoN3, hidden, customLabel, labelColor, attrib (JSONObject).
Province/state entity with name, countryIndex, regions, center, attrib.
City with name, province, countryIndex, localPosition (Vector3 on sphere), population, cityClass.
Hexagonal grid cell with index, center (Vector3), visible, canCross, tag.
A contiguous area of a country or province. Contains spherePoints (Vector3[]), center, neighbours, customMaterial.
Custom point of interest with name, type, countryIndex, provinceIndex, localPosition, customTags.
Return type for async operations (FlyTo, ZoomTo). Use .Then(callback) to chain actions after the operation completes.
Coordinate System
The globe uses sphere coordinates — Vector3 positions on a unit sphere centered at origin. The Conversion static class converts between sphere positions and latitude/longitude:
// Lat/Lon to sphere position
Vector3 spherePos = Conversion.GetSpherePointFromLatLon(40.4168f, -3.7038f);
// Sphere position to Lat/Lon
float lat, lon;
Conversion.GetLatLonFromSpherePoint(spherePos, out lat, out lon);
API Sections
The Globe API is organized into separate pages by category for easy reference. Each page covers a specific functional area — countries, provinces, cities, navigation, hex grid, fog of war, tile system, events, and more.
Basic Example
using UnityEngine;
using WPM;
public class GlobeExample : MonoBehaviour {
WorldMapGlobe map;
void Start() {
map = WorldMapGlobe.instance;
// Subscribe to country click
map.OnCountryClick += (int countryIndex, int regionIndex) => {
Country country = map.countries[countryIndex];
Debug.Log("Clicked: " + country.name);
};
// Fly to Spain with bounce
map.FlyToCountry("Spain", 2f, 0.2f);
// Color France
int france = map.GetCountryIndex("France");
map.ToggleCountrySurface(france, true, new Color(0, 0, 1, 0.5f));
}
}
Suggest an improvement
Help us improve this documentation page.