FAQ

beginner faq

World Map 2D Edition · Troubleshooting & FAQ

How do I access the map API from code?

Add using WPMF; at the top of your script and use the singleton:

WorldMap2D map = WorldMap2D.instance;

See the Scripting Reference for the full API.

How do I color a country?
int idx = map.GetCountryIndex("France");
map.ToggleCountrySurface(idx, true, Color.blue);
How do I fly to a specific location?
// By country name
map.FlyToCountry("Japan", 2f, 0.1f);

// By latitude/longitude
map.FlyToLatLon(35.6762f, 139.6503f, 2f, 0.05f);
How do I detect which country the user clicked?
map.OnCountryClick += (countryIndex, regionIndex) => {
    Debug.Log("Clicked: " + map.countries[countryIndex].name);
};
How do I add a custom marker on the map?
Vector2 pos = Conversion.GetLocalPositionFromLatLon(40.4168f, -3.7038f);
GameObject marker = GameObject.CreatePrimitive(PrimitiveType.Sphere);
map.AddMarker(marker, pos, 0.02f);
How do I draw a line between two points?
Vector2 start = Conversion.GetLocalPositionFromLatLon(40.4168f, -3.7038f); // Madrid
Vector2 end = Conversion.GetLocalPositionFromLatLon(48.8566f, 2.3522f);   // Paris
map.AddLine(start, end, Color.red, 0.1f, 2f, 0.005f, 0f);
Can I use a custom map instead of the real world?

Yes. Use the Map Editor to reshape borders, rename countries, and create entirely new regions. You can also modify the geodata files in Resources/Geodata directly.

How do I use the map as a UI overlay?

Enable the Viewport and check Screen Overlay Mode. This positions the map like a Canvas element at a normalized screen rectangle.

How do I switch between low and high detail frontiers at runtime?
map.frontiersDetail = FRONTIERS_DETAIL.High;
map.Redraw();
My question is not covered here

Please visit the Kronnect Support and post your question. Our team will respond shortly.

Is this asset compatible with Unity 6?

Yes. All Kronnect assets are fully compatible with Unity 6. The minimum supported version is Unity 2022.3 LTS, and this includes Unity 6 and any newer releases.


I have a question not covered here

Please visit the Support Center and use our AI Support Assistant to get answers. If the issue persists, submit a reproduction project so we can investigate further and help you.

Was this page helpful?