You can instantiate the prefab “WorldMapGlobe“ or add it to the scene from the Editor. Once the prefab is in the scene, you can access the functionality from code through the static instance property:
WorldMapGlobe map;
void Start () {
map = WorldMapGlobe.instance;
...
}
(Note that you can have more WorldMapGlobe instances in the same scene. In this case, the instance property will returns the same object. To use the API on a specific instance, you can get the WorldMapGlobe component of the GameObject).
Public Properties
Country related
map.countries: return a List<Country> of all countries records.
map.countryHighlighted: returns the Country object for the country under the mouse cursor (or null).
map.countryHighlightedIndex: returns the index of country under the mouse cursor (or null if none).
map.countryRegionHIghlightedIndex: returns the index of the region of currently highlighted country.
map.countryLastClickedIndex: returns the index of last country clicked.
map.enableCountryHighlight: set it to true to allow countries to be highlighted when mouse pass over them.
map.fillColor: color for the highlight of countries.
map.showCountryNames: enables/disables country labeling on the map.
map.showOutline: draws a border around countries highlightes or colored.
map.outlineColor: color of the outline.
map.showFrontiers: show/hide country frontiers. Same than inspector property.
map.frontiersDetail: detail level for frontiers. Specify the frontiers catalog to be used.
map.frontiersColor: color for all frontiers.
Cities related
map.cities: return a List<City> of all cities records.
map.cityHighlighted: returns the city under the mouse cursor (or null if none).
map.showCities: show/hide all cities. Same than inspector property.
map.minPopulation: the mínimum population amount for a city to appear on the map (in thousands). Set to zero to show all cities in the current catalog. Range: 0 .. 17000.
map.cityCatalog: the currently city catalog used.
Earth related
map.showEarth: show/hide the planet Earth. Same than inspector property.
map.earthStyle: the currently texture used in the Earth.
map.autoRotationSpeed: the speed of the automatic/continuous rotation of the Earth.
map.showLatitudeLines: draw latitude lines.
map.latitudeStepping: separation in degrees between each latitude line.
map.showLongitudeLines: draw longitude lines.
map.longitudeStepping: number of longitude lines.
map.gridColor: color of latitude and longitude lines.
User interaction
map.mouseIsOver: returns true if mouse has entered the Earth’s sphere collider.
map.navigationTime: time in seconds to fly to the destination (see FlyTo methods).
map.allowUserRotation/map.allowUserZoom: enables/disables user interaction with the map.
map.mouseWheelSensibility: multiplying factor for the zoom in/out functionality.
map.showCursor: enables the cursor over the map.
map.cursorFollowMouse: makes the cursor follow the map.
map.cursorLocation: current location of cursor in local coordinates (by default the sphere is size (1,1,1) so x/y/z can be in (-0.5,0.5) interval. Can be set and the cursor will move to that coordinate.
Labels related
map.countryLabelsSize: this is the relative size for labels. Controls how much the label can grow to fit the country area.
map.countryLabelsAbsoluteMinimumSize: minimum absolute size for all labels.
map.labelsQuality: specify the quality of the label rendering (Low, Medium, High).
map.showLabelsShadow: toggles label shadowing on/off.
map.countryLabelsColor: color for the country labels. Supports alpha.
map.countryLabelsShadowColor: color for the shadow of country labels. Also supports alpha.
Public Methods
map.GetCountryIndex(name): returns the index of the country in the collection.
map.FlyToCity(name): start navigation at navigationTime speed to specified city. The list of city names can be obtained through the cities property.
map.FlyToCity(index): same but specifying the city index in the cities list.
map.FlyToCountry(name): start navigation at navigationTime speed to specified country. The list of country names can be obtained through the cities property.
map.FlyToCountry(index): same but specifying the country index in the countries list.
map. FlyToLocation (x, y, z): same but specifying the location in local Unity spherical coordinates.
map.ToggleCountrySurface(name, visible, color): colorize one country with color provided or hide its surface (if visible = false).
map.ToggleCountrySurface(index, visible, color): same but passing the index of the country instead of the name.
map.ToggleCountryMainRegionSurface(index, visible, color): colorize and apply an optional texture to the main region of a country.
map.ToggleCountryRegionSurface(countryIndex, regionIndex, visible, color): same but only affects one single region of the country (not province/state but geographic region).
map.HideCountrySurface(countryIndex): un-colorize / hide specified country.
map.HideCountryRegionSurface(countryIndex): un-colorize / hide specified region of a country (not province/state but geographic region).
map.HideCountrySurfaces: un-colorize / hide all colorized countries (cancels ToggleCountrySurface).
map.ToggleContinentSurface(name, visible, color): colorize all countries belonging to speficied continent with color provided or hide its surface (if visible = false).
map.HideContinentSurface(name): un-colorize / hide specified continent.
map.Tilt & StraightenGlobe: returns the globe to default rotations.