Countries API

advanced scripting

World Map Globe Edition · Scripting Support (C#)

Class: All members on this page belong to WorldMapGlobe (namespace WPM). Access via WorldMapGlobe.instance.

Countries Properties

Country[] countries

Array of all countries. You can read or modify countries directly.

Country countryHighlighted { get; }

The country currently under the pointer (or null).

int countryHighlightedIndex { get; }

Index of the highlighted country (-1 if none).

int countryLastClicked { get; }

Index of the last country clicked.

bool enableCountryHighlight { get; set; }

Enable or disable country highlighting on hover.

bool highlightAllCountryRegions { get; set; }

Highlight all regions of a country (including exclaves) instead of just the hovered region.

bool enableCountryEnclaves { get; set; }

Include enclave regions in country data.

bool enableContinentHighlight { get; set; }

Enable continent-level highlighting.

string continentHighlighted { get; }

Name of the continent currently highlighted.

Query Methods

Country GetCountry(string countryName)

Returns a Country by name.

Country GetCountry(int countryIndex)

Returns a Country by index.

int GetCountryIndex(string countryName)

Returns the index of a country by name.

int GetCountryIndex(Vector3 spherePosition)

Returns the country at a sphere position.

int GetCountryNearPoint(Vector3 spherePosition)

Returns the nearest country to a sphere position.

int GetCountryIndexByISO_A2(string iso_a2)

Finds a country by ISO 3166-1 alpha-2 code (e.g., "ES" for Spain).

int GetCountryIndexByISO_A3(string iso_a3)

Finds a country by ISO 3166-1 alpha-3 code (e.g., "ESP").

int GetCountryIndexByFIPS10_4(string fips)

Finds a country by FIPS 10-4 code.

City GetCountryCapital(string countryName)

Returns the capital city of a country.

bool GetCountryIndex(Ray ray, out int countryIndex, out int regionIndex)

Gets the country and region at a ray intersection.

bool GetCountryUnderSpherePosition(Vector3 spherePoint, out int countryIndex, out int countryRegionIndex)

Returns country and region at a sphere point.

List<Country> CountryNeighbors(int countryIndex)

Returns all countries sharing a border.

void GetCountries(AttribPredicate predicate, List<Country> results)

Finds countries matching a custom attribute predicate.

Manipulation Methods

int CountryCreate(string name, string continent)

Creates a new country and returns its index.

int CountryAdd(Country country)

Adds an existing Country object and returns its index.

bool CountryRename(string oldName, string newName)

Renames a country.

bool CountryDelete(int countryIndex, bool deleteDependencies, bool redraw = true)

Deletes a country. If deleteDependencies is true, also removes provinces, cities, and mount points.

void CountriesDeleteFromContinent(string continentName)

Deletes all countries in a continent.

bool CountryTransferAsProvince(int targetCountryIndex, int sourceCountryIndex, bool redraw)

Converts a country into a province of another country.

bool CountryTransferCell(int countryIndex, int cellIndex, bool redraw)

Transfers a hex grid cell to a different country.

Surface & Visual Effects

void ToggleCountrySurface(int countryIndex, bool visible, Color color)

Shows or hides a colored overlay on a country. Also supports texture and outline parameters.

bool ToggleCountrySurface(string name, bool visible, Color color, bool drawOutline, Color outlineColor)

Toggles surface by country name.

GameObject ToggleCountryMainRegionSurface(int countryIndex, bool visible, Color color)

Toggles only the main region surface. Returns the surface GameObject.

void ToggleContinentSurface(string continentName, bool visible, Color color)

Colors an entire continent.

void HideCountrySurface(int countryIndex)

Hides all surfaces for a country.

void HideContinentSurface(string continentName)

Hides the continent surface.

GameObject DrawCountryOutline(int countryIndex, Color color)

Draws a custom outline around a country.

void ToggleCountryOutline(int countryIndex, bool visible, Color color)

Toggles a custom outline on/off.

GameObject ToggleCountryRegionOutline(int countryIndex, int regionIndex, bool visible, Color color)

Toggles outline for a specific region.

Attributes

string GetCountriesAttributes(bool prettyPrint = true)

Returns all country custom attributes as a JSON string.

void SetCountriesAttributes(string jSON)

Loads country attributes from a JSON string.

Was this page helpful?