/* INFINITY CODE */
/* https://infinity-code.com */
using UnityEngine;
namespace InfinityCode.OnlineMapsExamples
{
/// <summary>
/// Example how to get the available providers and to change the current provider.
/// </summary>
[AddComponentMenu("Infinity Code/Online Maps/Examples (API Usage)/ChangeProviderAndTypeExample")]
public class ChangeProviderAndTypeExample : MonoBehaviour
{
/// <summary>
/// Reference to the map. If not specified, the current instance will be used.
/// </summary>
public OnlineMaps map;
/// <summary>
/// Logs providers id and map types
/// </summary>
private void LogTypeList()
{
// Gets all providers
OnlineMapsProvider[] providers = OnlineMapsProvider.GetProviders();
foreach (OnlineMapsProvider provider in providers)
{
Debug.Log(provider.id);
foreach (OnlineMapsProvider.MapType type in provider.types)
{
Debug.Log(type);
}
}
}
private void Start()
{
// If map is not specified, use the current instance.
if (map == null) map = OnlineMaps.instance;
// Show full provider list
LogTypeList();
// Select Google Satellite
map.mapType = "google.satellite"; // providerID.typeID
// Select the first type for ArcGIS.
map.mapType = "arcgis"; // providerID
}
}
}