/// <summary> /// Make sure we have a set of GameObjectOptions to render the loaded geometry with. /// It uses defaults settings if no specific set of options has been given. /// This allows a different set of options to be used, e.g. with Road Borders enabled. /// Styling options must be set prior to loading the map, but can also be fine-tuned in /// WillCreate/DidCreate events. /// </summary> protected virtual void InitStylingOptions() { if (RenderingStyles == null) { RenderingStyles = ExampleDefaults.DefaultGameObjectOptions; } }
/// <summary> /// Use <see cref="MapsService"/> to load geometry. /// </summary> private void Start() { // Get required MapsService component on this GameObject. MapsService mapsService = GetComponent <MapsService>(); // Set real-world location to load. mapsService.InitFloatingOrigin(LatLng); // Configure Map Styling. GameObjectOptions options = new GameObjectOptions(); options.RegionStyle = RegionStyleSettings.Apply(options.RegionStyle); options.SegmentStyle = RoadStyleSettings.Apply(options.SegmentStyle); options.AreaWaterStyle = WaterStyleSettings.Apply(options.AreaWaterStyle); options.ExtrudedStructureStyle = ExtrudedStructureStyleSettings.Apply(options.ExtrudedStructureStyle); options.ModeledStructureStyle = ModeledStructureStyleSettings.Apply(options.ModeledStructureStyle); // Load map with default options. Bounds bounds = new Bounds(Vector3.zero, Vector3.one * LoadRange); mapsService.LoadMap(bounds, options); }
/// <summary> /// Get <see cref="MapsService"/> and use it to load geometry. /// </summary> private void Start() { // Get required Maps Service component on this GameObject. MapsService mapsService = GetComponent <MapsService>(); // Set location to load. mapsService.InitFloatingOrigin(LatLng); // Create a roads style that defines a material for roads and for borders of roads. The specific // border material used is chosen to look just a little darker than the material of the ground // plane (helping the roads to visually blend into the surrounding ground). SegmentStyle roadsStyle = new SegmentStyle.Builder { Material = Roads, BorderMaterial = RoadEdges, Width = 7.0f, BorderWidth = 1.0f }.Build(); // Get default style options. GameObjectOptions renderingStyles = ExampleDefaults.DefaultGameObjectOptions; // Replace default roads style with new, just created roads style. renderingStyles.SegmentStyle = roadsStyle; // Load map with desired options. mapsService.LoadMap(ExampleDefaults.DefaultBounds, renderingStyles); }
public override void ApplyStyle(GameObjectOptions options) { // The config panel might not have been initialized yet if it was inactive when this call was // made. if (StyleConfiguration == null) { InitMapConfig(); } options.AreaWaterStyle = StyleConfiguration; }
/// <summary> /// Create a <see cref="MapsService"/> to load buildings, then add borders around their bases and /// around the edges of roads. /// </summary> private void Start() { // Verify a Building Base Material has been given. if (BuildingAndRoadBorder == null) { Debug.LogError(ExampleErrors.MissingParameter(this, BuildingAndRoadBorder, "Building And Road Border", "to apply around the bases of buildings")); return; } // Verify a Roads Material has been given. if (Roads == null) { Debug.LogError(ExampleErrors.MissingParameter(this, Roads, "Roads", "to apply to roads")); return; } // Get the required Dynamic Maps Service on this GameObject. DynamicMapsService dynamicMapsService = GetComponent <DynamicMapsService>(); // Create a roads style that defines a material for roads and for borders of roads. The specific // border material used is chosen to look just a little darker than the material of the ground // plane (helping the roads to visually blend into the surrounding ground). SegmentStyle roadsStyle = new SegmentStyle.Builder { Material = Roads, BorderMaterial = BuildingAndRoadBorder, Width = 7.0f, BorderWidth = 1.0f }.Build(); // Get default style options. GameObjectOptions renderingStyles = ExampleDefaults.DefaultGameObjectOptions; // Replace default roads style with new, just created roads style. renderingStyles.SegmentStyle = roadsStyle; // Get required BuildingTexturer component on this GameObject. BuildingTexturer buildingTexturer = GetComponent <BuildingTexturer>(); // Sign up to event called after each new building is loaded, so can assign Materials to this // new building, and add an extruded base around the building to fake an Ambient Occlusion // contact shadow. Note that: // - DynamicMapsService.MapsService is auto-found on first access (so will not be null). // - This event must be set now during Awake, so that when Dynamic Maps Service starts loading // the map during Start, this event will be triggered for all Extruded Structures. dynamicMapsService.MapsService.Events.ExtrudedStructureEvents.DidCreate.AddListener(args => { // Apply nine sliced wall and roof materials to this building. // buildingTexturer.AssignNineSlicedMaterials(args.GameObject); // Add a border around base to building using Building Border Builder class, coloring it using // the given border Material. Extruder.AddBuildingBorder(args.GameObject, args.MapFeature.Shape, BuildingAndRoadBorder); }); }
private GameObjectOptions GetMapStyle() { var options = new GameObjectOptions(); options.RegionStyle = this.regionStyleSettings.Apply(options.RegionStyle); options.SegmentStyle = this.roadStyleSettings.Apply(options.SegmentStyle); options.AreaWaterStyle = this.waterStyleSettings.Apply(options.AreaWaterStyle); options.ExtrudedStructureStyle = this.extrudedStructureStyleSettings.Apply(options.ExtrudedStructureStyle); options.ModeledStructureStyle = this.modeledStructureStyleSettings.Apply(options.ModeledStructureStyle); return(options); }
public override void ApplyStyle(GameObjectOptions options) { Debug.Log("Apply segment styles"); // The config panel might not have been initialized yet if it was inactive when this call // was made. if (StyleConfiguration == null) { InitMapConfig(); } options.SegmentStyle = StyleConfiguration; }
public override void ApplyStyle(GameObjectOptions options) { Debug.Log("Apply area water styles"); // The config panel might not have been initialized yet if it was inactive when this call was // made. if (StyleConfiguration == null) { InitMapConfig(); } options.ModeledStructureStyle = StyleConfiguration; }
/// <summary> /// Generate <see cref="GameObjectOptions"/> from the style data provided in this object /// </summary> /// <returns><see cref="GameObjectOptions"/> from the style data provided in this object</returns> public GameObjectOptions GenerateStyle() { var style = new GameObjectOptions(); style.AreaWaterStyle = areaWaterStyleSettings.Apply(style.AreaWaterStyle); style.ExtrudedStructureStyle = extrudedStructureStyleSettings.Apply(style.ExtrudedStructureStyle); style.LineWaterStyle = lineWaterStyleSettings.Apply(style.LineWaterStyle); style.ModeledStructureStyle = modeledStructureStyleSettings.Apply(style.ModeledStructureStyle); style.RegionStyle = regionStyleSettings.Apply(style.RegionStyle); style.SegmentStyle = segmentStyleSettings.Apply(style.SegmentStyle); return(style); }
private void Start() { // Obtain default map objects styling _mapDefaultStyle = MapStyleProvider.Instance.GetMapStyle(MapStyleData.Type.Default); _mapLoader.Init(_mapDefaultStyle); _mapLoader.MapsService.InitFloatingOrigin(gutCoordinates); // Get permissions for using location services if (!Permission.HasUserAuthorizedPermission(Permission.FineLocation)) { Permission.RequestUserPermission(Permission.FineLocation); } }
/// <summary> /// Initializes Map Styling Options to default values. /// </summary> private void SetDefaultStyles(GameObjectOptions options) { if (options == null) { return; } options.ExtrudedStructureStyle = ExampleDefaults.DefaultGameObjectOptions.ExtrudedStructureStyle; options.ModeledStructureStyle = ExampleDefaults.DefaultGameObjectOptions.ModeledStructureStyle; options.RegionStyle = ExampleDefaults.DefaultGameObjectOptions.RegionStyle; options.AreaWaterStyle = ExampleDefaults.DefaultGameObjectOptions.AreaWaterStyle; options.LineWaterStyle = ExampleDefaults.DefaultGameObjectOptions.LineWaterStyle; options.SegmentStyle = ExampleDefaults.DefaultGameObjectOptions.SegmentStyle; }
private void ApplyCustomStyles(GameObjectOptions options) { if (options == null) { return; } for (int i = 0; i < panels.Count; i++) { IStyleConfigView viewConfig = panels[i].GetComponent <IStyleConfigView>(); if (viewConfig != null) { viewConfig.ApplyStyle(options); } } }
/// <summary> /// Initializes the style options for this game, by setting materials to roads, buildings /// and water areas. /// </summary> protected override void InitStylingOptions() { _zoinkiesStylesOptions = DefaultStyles.DefaultGameObjectOptions; // The default maps shader has a glossy property that allows the sky to reflect on it. Material waterMaterial = DefaultStyles.DefaultGameObjectOptions.RegionStyle.FillMaterial; waterMaterial.color = new Color(0.4274509804f, 0.7725490196f, 0.8941176471f); _zoinkiesStylesOptions.ModeledStructureStyle = new ModeledStructureStyle.Builder { Material = ModeledBuildingsMaterial }.Build(); _zoinkiesStylesOptions.RegionStyle = new RegionStyle.Builder { FillMaterial = GroundMaterial }.Build(); _zoinkiesStylesOptions.AreaWaterStyle = new AreaWaterStyle.Builder { FillMaterial = waterMaterial }.Build(); _zoinkiesStylesOptions.LineWaterStyle = new LineWaterStyle.Builder { Material = waterMaterial }.Build(); _zoinkiesStylesOptions.SegmentStyle = new SegmentStyle.Builder { Material = RoadsMaterial }.Build(); if (RenderingStyles == null) { RenderingStyles = _zoinkiesStylesOptions; } }
// Setup the Map Style using the GameObjectOption -- (Design the Map) void InitStyleOption() { mapObjectOptions = ExampleDefaults.DefaultGameObjectOptions; mapObjectOptions.ExtrudedStructureStyle = new ExtrudedStructureStyle.Builder { RoofMaterial = ExtrudedStructureRoofMaterial, WallMaterial = ExtrudedStructureWallMaterial }.Build(); mapObjectOptions.ModeledStructureStyle = new ModeledStructureStyle.Builder { Material = ModeledStructureMaterial }.Build(); mapObjectOptions.RegionStyle = new RegionStyle.Builder { FillMaterial = RegionMaterial }.Build(); mapObjectOptions.SegmentStyle = new SegmentStyle.Builder { Material = SegmentMaterial //BorderMaterial = SegmentBorderMaterial }.Build(); mapObjectOptions.AreaWaterStyle = new AreaWaterStyle.Builder { FillMaterial = AreaWaterMaterial }.Build(); mapObjectOptions.LineWaterStyle = new LineWaterStyle.Builder { Material = LineWaterMaterial, BorderMaterial = LineWaterMaterial }.Build(); }
/// <summary> /// Setup default <see cref="GameObjectOptions"/>. /// </summary> static ExampleDefaults() { // Find shaders that will be used to create required Materials for rendering geometry // generated by the Maps SDK for Unity. Shader standardShader = Shader.Find("Google/Maps/Shaders/Standard"); if (standardShader == null) { // Try to find the Unity Standard Shader as a backup. standardShader = Shader.Find("Standard"); if (standardShader == null) { // Try to find the Legacy Diffuse Shader as a backup-backup. standardShader = Shader.Find("Diffuse"); if (standardShader == null) { Debug.LogErrorFormat( "Unable to find Maps SDK for Unity Standard Shader (named " + "\"Google/Maps/Shaders/Standard\"), or as a backup the Unity Standard " + "Shader (named \"Standard\"), or as a backup-backup the Legacy Unity " + "Standard Shader (named \"Diffuse\"), so cannot setup default materials in {0}", typeof(ExampleDefaults)); return; } Debug.LogWarningFormat( "Unable to find Maps SDK for Unity Standard Shader (named " + "\"Google/Maps/Shaders/Standard\"), or as a backup the Unity Standard Shader " + "(named \"Standard\")\nDefaulting to Legacy Unity Standard Shader (named" + "\"Diffuse\") as a backup-backup for setting up default materials in {0}", typeof(ExampleDefaults)); } else { Debug.LogWarningFormat( "Unable to find Maps SDK for Unity Standard Shader (named " + "\"Google/Maps/Shaders/Standard\").\nDefaulting to the Unity Standard Shader " + "(named \"Standard\") as a backup for setting up default materials in {0}", typeof(ExampleDefaults)); } } // Find BaseMaps Shader. Note that this Shader does not have a backup, as it has unique // behaviour needed for BaseMap level geometry to show in the correct render order. Shader baseMapShader = Shader.Find("Google/Maps/Shaders/BaseMap Color"); if (baseMapShader == null) { Debug.LogErrorFormat( "Unable to find Maps SDK for Unity Base Map Shader (named " + "\"Google/Maps/Shaders/BaseMap Color\"), so unable to setup default materials in " + "{0}", typeof(ExampleDefaults)); return; } // Create default materials for use by buildings, as well as other materials for use by water, // ground, roads, etc. Material wallMaterial = new Material(standardShader) { color = new Color(1f, 0.75f, 0.5f) }; Material roofMaterial = new Material(standardShader) { color = new Color(1f, 0.8f, 0.6f) }; Material regionMaterial = new Material(baseMapShader) { color = new Color(0.5f, 0.7f, 0.5f), }; regionMaterial.SetFloat("_Glossiness", 1f); Material waterMaterial = new Material(baseMapShader) { color = new Color(0.0f, 1.0f, 1.0f), }; waterMaterial.SetFloat("_Glossiness", 1f); Material segmentMaterial = new Material(baseMapShader) { color = new Color(0.5f, 0.5f, 0.5f), }; segmentMaterial.SetFloat("_Glossiness", 0.5f); // Create style for buildings made from extruded shapes (most buildings). ExtrudedStructureStyle extrudedStructureStyle = new ExtrudedStructureStyle .Builder { WallMaterial = wallMaterial, RoofMaterial = roofMaterial } .Build(); // Create style for buildings with detailed vertex/triangle data (such as the Statue of // Liberty). ModeledStructureStyle modeledStructureStyle = new ModeledStructureStyle.Builder { Material = wallMaterial }.Build(); // Create style for regions (such as parks). RegionStyle regionStyle = new RegionStyle.Builder { FillMaterial = regionMaterial }.Build(); // Create style for bodies of water (such as oceans). AreaWaterStyle areaWaterStyle = new AreaWaterStyle.Builder { FillMaterial = waterMaterial }.Build(); // Create style for lines of water (such as narrow rivers). LineWaterStyle lineWaterStyle = new LineWaterStyle.Builder { Material = waterMaterial }.Build(); // Create style for segments (such as roads). SegmentStyle segmentStyle = new SegmentStyle.Builder { Material = segmentMaterial, Width = 7.0f }.Build(); // Collect styles into a form that can be given to map loading function. DefaultGameObjectOptions = new GameObjectOptions { ExtrudedStructureStyle = extrudedStructureStyle, ModeledStructureStyle = modeledStructureStyle, RegionStyle = regionStyle, AreaWaterStyle = areaWaterStyle, LineWaterStyle = lineWaterStyle, SegmentStyle = segmentStyle, }; }
private void Start() { // Obtain default map objects styling _mapDefaultStyle = MapStyleProvider.Instance.GetMapStyle(MapStyleData.Type.Default); }
/// <summary> /// Returns a new <see cref="GameObjectOptions"/> instance reflecting the properties on /// this component. /// </summary> private GameObjectOptions CreateGameObjectOptions() { GameObjectOptions gameObjectOptions = new GameObjectOptions(); // Terrain style TerrainStyle.Builder terrainStyleBuilder = new TerrainStyle.Builder() { AlphaMapResolutionMetersPerPixel = AlphaMapResolutionMetersPerPixel, BaseMapResolutionMetersPerPixel = BaseMapResolutionMetersPerPixel, BaseMapDistance = BaseMapDistance, TerrainLayers = new List <TerrainLayer>(TerrainLayers), }; gameObjectOptions.TerrainStyle = terrainStyleBuilder.Build(); // Segment style SegmentStyle.Builder segmentStyleBuilder = new SegmentStyle.Builder() { Material = SegmentMaterial, IntersectionMaterial = IntersectionMaterial, GameObjectLayer = gameObjectOptions.TerrainStyle.TerrainPaintingLayer }; gameObjectOptions.SegmentStyle = segmentStyleBuilder.Build(); // Area water style AreaWaterStyle.Builder areaWaterStyleBuilder = new AreaWaterStyle.Builder() { FillMaterial = AreaWaterMaterial, GameObjectLayer = gameObjectOptions.TerrainStyle.TerrainPaintingLayer }; gameObjectOptions.AreaWaterStyle = areaWaterStyleBuilder.Build(); // Region style RegionStyle.Builder regionStyleBuilder = new RegionStyle.Builder() { FillMaterial = RegionMaterial, GameObjectLayer = gameObjectOptions.TerrainStyle.TerrainPaintingLayer }; gameObjectOptions.RegionStyle = regionStyleBuilder.Build(); // Line water style LineWaterStyle.Builder lineWaterStyleBuilder = new LineWaterStyle.Builder() { Material = LineWaterMaterial, GameObjectLayer = gameObjectOptions.TerrainStyle.TerrainPaintingLayer }; gameObjectOptions.LineWaterStyle = lineWaterStyleBuilder.Build(); // Extruded structure style ExtrudedStructureStyle.Builder extrudedStructureStyleBuilder = new ExtrudedStructureStyle.Builder() { RoofMaterial = BuildingMaterial, WallMaterial = BuildingMaterial }; gameObjectOptions.ExtrudedStructureStyle = extrudedStructureStyleBuilder.Build(); // Modeled structure style ModeledStructureStyle.Builder modeledStructureStyleBuilder = new ModeledStructureStyle.Builder() { Material = BuildingMaterial }; gameObjectOptions.ModeledStructureStyle = modeledStructureStyleBuilder.Build(); return(gameObjectOptions); }
/// <summary> /// Regenerate <see cref="M:GameObjectOptions"/> and trigger preview refresh when any of the /// properties on this component change. /// </summary> public void OnValidate() { _GameObjectOptions = null; gameObject.GetComponent <MapsService>().RefreshPreview(); // Needed for edit mode }
public abstract void ApplyStyle(GameObjectOptions options);
private void InitializeMap(GPSLatLong latLong) { if (this.printDebugOutput) { Debug.Log($"GoogleMapsManager Initializing Map To ({latLong})"); } this.currentLatLong = latLong; // Registering for error handling (Taken from BaseMapLoader.cs) this.mapsService.Events.MapEvents.LoadError.AddListener(args => { switch (args.DetailedErrorCode) { case MapLoadErrorArgs.DetailedErrorEnum.NetworkError: { // Handle errors caused by a lack of internet connectivity (or other network problems). if (Application.internetReachability == NetworkReachability.NotReachable) { Debug.LogError("The Maps SDK for Unity must have internet access in order to run."); } else { Debug.LogErrorFormat( "The Maps SDK for Unity was not able to get a HTTP response after " + "{0} attempts.\nThis suggests an issue with the network, or with the " + "online Semantic Tile API, or that the request exceeded its deadline " + "(consider using MapLoadErrorArgs.TimeoutSeconds).\n{1}", args.Attempts, string.IsNullOrEmpty(args.Message) ? string.Concat("Specific error message received: ", args.Message) : "No error message received."); } return; } case MapLoadErrorArgs.DetailedErrorEnum.UnsupportedClientVersion: { Debug.LogError( "The specific version of the Maps SDK for Unity being used is no longer " + "supported (possibly in combination with the specific API key used)."); return; } } // For all other types of errors, just show the given error message, as this should describe // the specific nature of the problem. Debug.LogError(args.Message); // Note that the Maps SDK for Unity will automatically retry failed attempts, unless // args.Retry is specifically set to false during this callback. }); // Set real-world location to load this.mapsService.InitFloatingOrigin(new LatLng(latLong.Latitude, latLong.Longitude)); // Configure Map Styling this.gameObjectOptions = this.GetMapStyle(); this.LoadMap(); }
/// <summary> /// Connect to <see cref="FloatingOriginUpdater.OnFloatingOriginUpdate"/>, so that whenever the /// world's Floating Origin is moved, all controlled world space textured /// <see cref="WorldspaceMaterials"/> are realigned to the world's new Floating Origin. /// </summary> private void Start() { // Verify all required parameters are defined, skipping further setup if not. if (!VerifyParameters()) { enabled = false; return; } // Get the required Floating Origin component on this GameObject. FloatingOriginUpdater floatingOriginUpdater = GetComponent <FloatingOriginUpdater>(); // Make sure that whenever the Floating Origin is updated, Materials are updated in sync. floatingOriginUpdater.OnFloatingOriginUpdate.AddListener(UpdateWorldspaceMaterialOffsets); // Store all Materials that are to be updated. This function only stores Materials that have an // _Offset Vector, which will be used to offset the Material's world space coordinates to align // to the world's moved Floating Origin. TryAddMaterial(Buildings); TryAddMaterial(Roads); TryAddMaterial(Ground); TryAddMaterial(Water); // Because the Floating Origin has not yet been moved, there is no need to apply an _Offset to // these Materials yet. Instead we make sure these Material's _Offsets start at (0, 0, 0). UpdateWorldspaceMaterialOffsets(Vector3.zero); // Create styles to assign world space textured Materials to geometry as it is created. ExtrudedStructureStyle extrudedStructureStyle = new ExtrudedStructureStyle.Builder { WallMaterial = Buildings, RoofMaterial = Buildings }.Build(); ModeledStructureStyle modeledStructureStyle = new ModeledStructureStyle.Builder { Material = Buildings }.Build(); SegmentStyle roadsStyle = new SegmentStyle.Builder { Material = Roads, BorderMaterial = Borders, Width = 7.0f, BorderWidth = BorderWidth }.Build(); RegionStyle groundStyle = new RegionStyle.Builder { FillMaterial = Ground }.Build(); AreaWaterStyle areaWaterStyle = new AreaWaterStyle.Builder { FillMaterial = Water }.Build(); LineWaterStyle lineWaterStyle = new LineWaterStyle.Builder { Material = Water, Width = 7.0f }.Build(); GameObjectOptions renderingStyles = ExampleDefaults.DefaultGameObjectOptions; renderingStyles.ExtrudedStructureStyle = extrudedStructureStyle; renderingStyles.ModeledStructureStyle = modeledStructureStyle; renderingStyles.SegmentStyle = roadsStyle; renderingStyles.RegionStyle = groundStyle; renderingStyles.AreaWaterStyle = areaWaterStyle; renderingStyles.LineWaterStyle = lineWaterStyle; DynamicMapsService dynamicMapsService = floatingOriginUpdater.DynamicMapsService; dynamicMapsService.RenderingStyles = renderingStyles; // Make sure that if any new Materials are cloned by the Maps Service (which can occur to // resolve z-fighting issues), that these new cloned materials are added to the list of managed // Materials. MapsService mapsService = dynamicMapsService.MapsService; mapsService.Events.RegionEvents.DidCreate.AddListener( args => TryAddMaterialFrom(args.GameObject)); mapsService.Events.AreaWaterEvents.DidCreate.AddListener( args => TryAddMaterialFrom(args.GameObject)); mapsService.Events.LineWaterEvents.DidCreate.AddListener( args => TryAddMaterialFrom(args.GameObject)); mapsService.Events.SegmentEvents.DidCreate.AddListener( args => TryAddMaterialFrom(args.GameObject)); mapsService.Events.ModeledStructureEvents.DidCreate.AddListener( args => TryAddMaterialFrom(args.GameObject)); // For extruded buildings, also create borders around the edges of these buildings, to match // borders around roads. mapsService.Events.ExtrudedStructureEvents.DidCreate.AddListener(args => { Debug.Log(args.MapFeature.MapFeatureMetadata.PlaceId); TryAddMaterialFrom(args.GameObject); Extruder.AddBuildingBorder(args.GameObject, args.MapFeature.Shape, Borders, BorderWidth); }); }
/// <summary> /// Setup this script if have not done so already. /// </summary> private void Start() { // Verify all required parameters are defined and correctly setup, skipping any further setup if // any parameter is missing or invalid. if (!VerifyParameters()) { // Disable this script to prevent error spamming (where Update will producing one or more // errors every frame because one or more parameters are undefined). enabled = false; return; } // Move the Ground plane to be directly underneath the main Camera. We do this again whenever // the main Camera moves. ReCenterGround(); // Set real-world location to load. Note that the MapsService variable is auto-found on first // access. MapsService.InitFloatingOrigin(LatLng); // Make sure we have a set of GameObjectOptions to render loaded geometry with, using defaults // if no specific set of options has been given. This allows a different set of options to be // used, e.g. with Road Borders enabled, provided these new options are set into this parameter // before this Start function is called. if (RenderingStyles == null) { RenderingStyles = ExampleDefaults.DefaultGameObjectOptions; } // Connect to Maps Service error event so we can be informed if an error occurs while trying to // load tiles. However, if this GameObject also contains an Error Handling Component, then we // skip handling errors here, leaving it to the Error Handling Component instead. if (GetComponent <ErrorHandling>() == null) { MapsService.Events.MapEvents.LoadError.AddListener(args => { if (args.Retry) { Debug.LogWarning(args); } else { Debug.LogError(args); } }); } // Revert loading flag to false whenever loading finishes (this flag is set to true whenever // loading starts, and so it remain true until the currently requested geometry has finished // loading). MapsService.Events.MapEvents.Loaded.AddListener(args => Loading = false); // Load the current viewport. RefreshView(); // Now load map around the camera. MapsService.MakeMapLoadRegion() .AddCircle(Camera.main.transform.position, MaxDistance) .Load(RenderingStyles); StartCoroutines(); if (OnMapLoadStarted != null) { OnMapLoadStarted.Invoke(); } }