/// <summary> /// Create a <see cref="MapsService"/> to load geometry. /// </summary> private void Start() { // Verify that a Sun and Moon Controller has been defined. if (SunAndMoonController == null) { ExampleErrors.MissingParameter(this, SunAndMoonController, "Sun and Moon Controller"); return; } // Get required BuildingTexturer component on this GameObject. BuildingTexturer buildingTexturer = GetComponent <BuildingTexturer>(); // Get required Emission Controller component, and give the Building Wall Materials to it so // that the building windows can be lit up at night time. GetComponent <EmissionController>().SetMaterials(buildingTexturer.WallMaterials); // Get required Dynamic Maps Service component on this GameObject. DynamicMapsService dynamicMapsService = GetComponent <DynamicMapsService>(); // Sign up to event called after each new building is loaded, so can assign Materials to this // new building. 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 => buildingTexturer.AssignNineSlicedMaterials(args.GameObject)); // Sign up to event called after all buildings have been loaded, so can start animating // day-night cycle. dynamicMapsService.MapsService.Events.MapEvents.Loaded.AddListener( args => SunAndMoonController.StartAnimating()); }
/// <summary> /// Assign a randomly chosen Wall and Roof <see cref="Material"/> to a given building. /// </summary> /// <param name="building">Building to assign <see cref="Material"/>s to.</param> /// <param name="index"> /// Optional index of Wall and Roof <see cref="Material"/> pair to apply. If this value is not /// set a random <see cref="Material"/> pair will be used. /// </param> internal void AssignNineSlicedMaterials(GameObject building, int?index = null) { // If a specific Material index was given, verify it is a valid index for a Wall and Roof // Material pair. if (index.HasValue) { if (index.Value < 0 || index.Value >= WallMaterials.Length) { Debug.LogError(ExampleErrors.InvalidArrayIndex(this, WallMaterials, "Wall Materials", index.Value)); return; } } else { // Pick a random Material index to use for both Wall and Roof Materials. Not that the same // index will work for both arrays of Materials, as we have already verified that the Wall and // Roof Material arrays are the same length. index = Random.Range(0, WallMaterials.Length); } // Replace building MeshRenderer's sharedMaterials array with chosen Materials. Note that this // must be done by creating a new array of Materials, rather than altering the entries of this // MeshRenderer's sharedMaterials array, as altering the existing array will not actually // change the MeshRenderer's Materials. MeshRenderer buildingMeshRenderer = building.GetComponent <MeshRenderer>(); buildingMeshRenderer.sharedMaterials = new Material[] { WallMaterials[index.Value], RoofMaterials[index.Value] }; }
/// <summary> /// Make sure the given <see cref="NearDistance"/> and <see cref="FarDistance"/> define a valid /// distance range. /// </summary> /// <returns> /// True if <see cref="NearDistance"/> and <see cref="FarDistance"/> are both positive, and if /// <see cref="NearDistance"/> is greater than <see cref="FarDistance"/> (otherwise a specific /// error message will be shown). /// </returns> private bool VerifyRange() { // Make sure both given distances are positive. if (NearDistance <= 0f) { Debug.LogError(ExampleErrors.NotGreaterThanZero(this, NearDistance, "Near Distance")); return(false); } if (FarDistance <= 0f) { Debug.LogError(ExampleErrors.NotGreaterThanZero(this, FarDistance, "Far Distance")); return(false); } // Make sure the given far distance is greater than near distance. if (FarDistance <= NearDistance) { Debug.LogError(ExampleErrors .NotGreaterThan(this, FarDistance, "Far Distance", NearDistance, "Near Distance")); return(false); } // If have reached this point then given near and far distances are valid, so return true. return(true); }
/// <summary>Connect camera to slider.</summary> private void Awake() { // Make sure the given near and far distances are valid, skipping setup if not. if (!VerifyRange()) { return; } // Get required SliderController for getting input from UI Slider. SliderController = GetComponent <SliderController>(); // Make sure that given start distance is within range of given near and far distances. if (StartDistance < NearDistance || StartDistance > FarDistance) { Debug.LogError(ExampleErrors .OutsideRange(this, StartDistance, "Start Distance", NearDistance, FarDistance)); StartDistance = Mathf.Clamp(StartDistance, NearDistance, FarDistance); } // Convert start distance to a percent of near and far distances, and adjust slider to this // value. float sliderFraction = (StartDistance - NearDistance) / (FarDistance - NearDistance); OnSlider(sliderFraction); // Set slider's starting value, and only after have done so, connect future changes in slider // input to zooming in and out. SliderController.SetStartingValue(sliderFraction); SliderController.OnChange += OnSlider; }
/// <summary> /// Verify that all required parameters have been correctly defined, showing a specific error and /// returning false if not. /// </summary> private bool VerifyParameters() { // Verify this scene has a main Camera. if (Camera.main == null) { Debug.LogError(ExampleErrors.NullMainCamera(this, "to keep the AR Compass Map in front of")); return(false); } // Verify a Background UI element has been given, and that it has a default texture (to use as // a backup if augmented reality mode is not available). if (Background == null) { Debug.LogError(ExampleErrors.MissingParameter(this, Background, "Background", "to show the real world background on device")); return(false); } if (Background.texture == null) { Debug.LogErrorFormat("No default texture applied to {0}, defined as {1}.{2}.Background.\n" + "This UI element must have a default texture to use if AR mode is not available on " + "device.", Background.name, name, GetType()); return(false); } // If we have reached this point then we have verified that all required parts are present and // properly setup. return(true); }
/// <summary> /// Use <see cref="DynamicMapsService"/> to load geometry, replacing any buildings as needed. /// </summary> private void Awake() { // Make sure a prefab has been specified. if (Prefab == null) { Debug.LogError(ExampleErrors.MissingParameter(this, Prefab, "Prefab", "to replace specific buildings with")); return; } // Get required DynamicMapsService component on this GameObject. DynamicMapsService dynamicMapsService = GetComponent <DynamicMapsService>(); // See if any options have been set indicating which types of buildings to replace, signing up // to WillCreate events if so. if (ReplaceBars || ReplaceBanks || ReplaceLodgings || ReplaceCafes || ReplaceRestaurants || ReplaceEventVenues || ReplaceTouristDestinations || ReplaceShops || ReplaceSchools || ReplaceUnspecifieds) { // Create styles for ExtrudedStructure and ModeledStructure type buildings that are to be // replaced with a prefab. ExtrudedStructureStyle extrudedPrefabStyle = new ExtrudedStructureStyle.Builder { Prefab = Prefab }.Build(); ModeledStructureStyle modeledPrefabStyle = new ModeledStructureStyle.Builder { Prefab = Prefab }.Build(); // Sign up to events called just before any new building is loaded, so we can check each // building's usage type and replace it with prefab if needed. Note that: // - DynamicMapsService.MapsService is auto-found on first access (so will not be null). // - These events must be set now during Awake, so that when DynamicMapsService starts // loading the map during Start, these event will be triggered for all ExtrudedStructures // and ModeledStructures. dynamicMapsService.MapsService.Events.ExtrudedStructureEvents.WillCreate.AddListener(args => { if (ShouldReplaceBuilding(args.MapFeature.Metadata.Usage)) { args.Style = extrudedPrefabStyle; } }); dynamicMapsService.MapsService.Events.ModeledStructureEvents.WillCreate.AddListener(args => { if (ShouldReplaceBuilding(args.MapFeature.Metadata.Usage)) { args.Style = modeledPrefabStyle; } }); } // See if we should be replacing any suppressed buildings with prefab, signing up to DidCreate // event if so. if (ReplaceSuppressed) { // Sign up to event called just after any new building is loaded, so we can check if the // building's mesh has been suppressed and should be replaced with a prefab. dynamicMapsService.MapsService.Events.ExtrudedStructureEvents.DidCreate.AddListener( args => TryReplaceSuppressedBuilding(args.GameObject)); dynamicMapsService.MapsService.Events.ModeledStructureEvents.DidCreate.AddListener( args => TryReplaceSuppressedBuilding(args.GameObject)); } }
/// <summary> /// Check that we have a <see cref="BaseMapLoader"/> so that we can register appropriate /// listeners in OnEnable. /// </summary> protected override void Awake() { if (BaseMapLoader == null) { Debug.LogError(ExampleErrors.MissingParameter( this, BaseMapLoader, "Base Map Loader", "is required for this script to work.")); } base.Awake(); }
/// <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 void Awake() { // Verify that we have a base map loader available // Get the required base map loader if (BaseMapLoader == null) { Debug.LogError(ExampleErrors.MissingParameter( this, BaseMapLoader, "Base Map Loader", "is required for this script to work.")); } }
/// <summary> /// Make sure all required parameters are given, and connect to <see cref="MapsService"/>'s /// <see cref="Google.Maps.Event.MapEvents.Progress"/> event so we can display loading progress /// on screen. /// </summary> void Awake() { if (BaseMapLoader == null) { Debug.LogError(ExampleErrors.MissingParameter( this, BaseMapLoader, "Base Map Loader", "is required for this script to work.")); return; } HideProgressBar(); }
/// <summary> /// Setup <see cref="Slider"/>. /// </summary> private void Awake() { // Make sure we have a UI Slider to work with, printing an error if not. if (Slider == null) { Debug.LogError(ExampleErrors.MissingParameter(this, Slider, "Slider")); return; } // Connect changes in Slider's value to given action. Slider.onValueChanged.AddListener(TryOnChange); }
/// <summary> /// Verify that all required parameters have been correctly defined, returning false if not. /// </summary> private bool VerifyParameters() { // Verify that all required Materials have been given. if (Buildings == null) { Debug.LogError(ExampleErrors.MissingParameter( this, Buildings, "Buildings", "to assign to buildings")); return(false); } if (Roads == null) { Debug.LogError(ExampleErrors.MissingParameter( this, Roads, "Roads", "to assign to road segments")); return(false); } if (Borders == null) { Debug.LogError(ExampleErrors.MissingParameter( this, Borders, "Borders", "to assign to the borders of road segments and buildings")); return(false); } if (Ground == null) { Debug.LogError(ExampleErrors.MissingParameter( this, Ground, "Ground", "to assign to ground regions")); return(false); } if (Water == null) { Debug.LogError(ExampleErrors.MissingParameter(this, Water, "Water", "to assign to water")); return(false); } // Verify at least one of the given Materials' Shader has a Vector that can be used for // providing the world's Floating Origin. if (!Buildings.HasProperty(MaterialOffsetProperty) && !Roads.HasProperty(MaterialOffsetProperty) && !Borders.HasProperty(MaterialOffsetProperty) && !Ground.HasProperty(MaterialOffsetProperty) && !Water.HasProperty(MaterialOffsetProperty)) { Debug.LogErrorFormat("No '{0}' property found on any of the Shaders of any of the Materials " + "given to {1}.{2}.\n{2} is used to adjust the offset of this Material's world space " + "texture coordinates, but given none of the given Materials had a '{0}' property to " + "use for this purpose, {1}.{2} will be disabled.", MaterialOffsetProperty, name, GetType()); } // If have reached this point then have verified that all required parts are present and // properly setup. return(true); }
/// <summary> /// Use <see cref="MapsService"/> to load geometry, labelling all created roads with their /// names. /// </summary> void Awake() { // Get the required base map loader. if (BaseMapLoader == null) { Debug.LogError(ExampleErrors.MissingParameter( this, BaseMapLoader, "Base Map Loader", "is required for this script to work.")); } // Register listeners prior to loading the map. BaseMapLoader.MapsService.Events.ExtrudedStructureEvents.DidCreate.AddListener( OnExtrudedStructureCreated); BaseMapLoader.MapsService.Events.ModeledStructureEvents.DidCreate.AddListener( OnModeledStructureCreated); BaseMapLoader.MapsService.Events.MapEvents.Loaded.AddListener(OnMapLoaded); }
/// <summary>Make sure all required parameters are given.</summary> private void Awake() { // Make sure a canvas has been specified. if (Canvas == null) { Debug.LogError(ExampleErrors.MissingParameter(this, Canvas, "Canvas", "to show road names")); return; } // Make sure a prefab has been specified. if (LabelPrefab == null) { Debug.LogError(ExampleErrors.MissingParameter(this, LabelPrefab, "LabelPrefab", "to use to display names above roads in scene")); } }
/// <summary> /// Verify that all required parameters have been correctly defined, returning false if not. /// </summary> private bool VerifyParameters() { // Verify that an Emission Controller has been defined. if (EmissionController == null) { Debug.LogError(ExampleErrors.MissingParameter(this, EmissionController, "Emission Controller", "to control the emission values of in-scene lights/windows")); return(false); } // Get required light on this gameObject and make sure it is a directional light. Light = GetComponent <Light>(); if (Light.type != LightType.Directional) { Debug.LogWarningFormat("{0}.{1} found a {2}-light attached to {0}, when a Directional Light " + "was expected.\n Changing type from {2} to Directional.", name, GetType(), Light.type); Light.type = LightType.Directional; } // Verify given Fog Distances. if (FogStart < 0f) { Debug.LogError(ExampleErrors.NotGreaterThanZero(this, FogStart, "Fog Start distance", ", as this represents the Linear Fog Start Distance for the scene")); return(false); } if (FogEnd < FogStart) { Debug.LogError(ExampleErrors.NotGreaterThan(this, FogEnd, "Fog End distance", FogStart, "Fog Start distance")); return(false); } // Verify given Render Distance is positive. if (RenderDistance < 0f) { Debug.LogError(ExampleErrors.NotGreaterThanZero(this, RenderDistance, "Render Distance", ", as this represents the Camera's far Clipping Plane")); return(false); } // If have reached this point then have verified that all required parts are present and // properly setup. return(true); }
/// <summary>Make sure all required parameters are given.</summary> protected virtual void Awake() { // Make sure a canvas has been specified. if (Canvas == null) { Debug.LogError(ExampleErrors.MissingParameter(this, Canvas, "Canvas", "to show labels")); return; } // Make sure a prefab has been specified. if (LabelPrefab == null) { Debug.LogError(ExampleErrors.MissingParameter( this, LabelPrefab, "Label", "to use to display labels for objects in scene")); } }
// Start is called before the first frame update void Start() { IsReady = true; if (BaseMapLoader == null) { Debug.LogError(ExampleErrors.MissingParameter( this, BaseMapLoader, "Base Map Loader", "is required for this script to work.")); IsReady = false; } if (PathFindingExample == null) { Debug.LogError(ExampleErrors.MissingParameter( this, PathFindingExample, "Path Finding Example", "is required for this script to work.")); IsReady = false; } if (RoadLatticeNodesVisualizer == null) { Debug.LogError(ExampleErrors.MissingParameter( this, RoadLatticeNodesVisualizer, "Road Lattice Nodes Visualizer", "is required for this script to work.")); IsReady = false; } if (ShowRoadLatticeToggle != null) { ShowRoadLatticeToggle.isOn = RoadLatticeNodesVisualizer.RoadLattice.activeSelf; } if (ShowAIPathsToggle != null) { ShowAIPathsToggle.isOn = PathFindingExample.IsDebugPathOn; } if (ActivateAIBotsToggle != null) { ActivateAIBotsToggle.isOn = PathFindingExample.IsAISearchActive; } }
void Awake() { // 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; } // Get the required base map loader if (BaseMapLoader == null) { Debug.LogError(ExampleErrors.MissingParameter( this, BaseMapLoader, "Base Map Loader", "is required for this script to work.")); } }
/// <summary> /// Verify that all required parameters have been correctly defined, returning false if not. /// </summary> private bool VerifyParameters() { // Verify that a Ground plane has been given. if (Ground == null) { Debug.LogError(ExampleErrors.MissingParameter(this, Ground, "Ground")); return(false); } // Verify that there is a Camera.main in the scene (i.e. a Camera that is tagged: "MainCamera"). if (Camera.main == null) { Debug.LogError(ExampleErrors.NullMainCamera(this)); return(false); } // If have reached this point then we have verified all required parameters. return(true); }
/// <summary> /// Verify given <see cref="Material"/> arrays are valid (not empty nor containing any null /// entries, and both arrays of the same length). /// </summary> private void Awake() { // Verify that at least one Wall Material and at least one Roof Material has been given. if (WallMaterials.Length == 0) { Debug.LogError(ExampleErrors.EmptyArray(this, WallMaterials, "Wall Materials")); return; } if (RoofMaterials.Length == 0) { Debug.LogError(ExampleErrors.EmptyArray(this, RoofMaterials, "Roof Materials")); return; } // Verify that the same number of Wall and Roof Materials have been given. if (WallMaterials.Length != RoofMaterials.Length) { Debug.LogErrorFormat("Incorrect number of Building Roof Materials defined for {0}.{1}: {2} " + "Building Wall Materials were given, but {3} Building Roof Materials were given.\n{1} " + "needs the same number of Building Roof Materials as Building Wall Materials, i.e. {2} " + "of each.", name, GetType(), WallMaterials.Length, RoofMaterials.Length); return; } // Verify that no null Materials have been given. for (int i = 0; i < WallMaterials.Length; i++) { if (WallMaterials[i] == null) { Debug.LogError(ExampleErrors.NullArrayElement(this, WallMaterials, "Wall Materials", i)); return; } if (RoofMaterials[i] == null) { Debug.LogError(ExampleErrors.NullArrayElement(this, RoofMaterials, "Roof Materials", i)); return; } } // If have reached this point then have verified that all required parts are present and // properly set up. }
/// <summary> /// Use <see cref="CameraController"/>'s OnMove event to detect when the <see cref="Camera"/> has /// moved far enough that the Floating Origin needs to be recentered. /// </summary> private void Awake() { // Verify a Camera Controller has been given. if (CameraController == null) { Debug.LogError(ExampleErrors.MissingParameter(this, CameraController, "Camera Controller", "to tell when the Camera has moved")); return; } // Verify that a valid Floating Origin range was given, i.e. that given distance was not // negative nor zero. Comparison is made to float.Epsilon instead of zero to account for float // rounding errors. if (FloatingOriginRange <= float.Epsilon) { Debug.LogError(ExampleErrors.NotGreaterThanZero(this, FloatingOriginRange, "Floating Origin Range", "to tell how far the Camera should move before the Floating " + "Origin is reset")); return; } // Store the required Dynamic Maps Service on this GameObject. DynamicMapsService = GetComponent <DynamicMapsService>(); // Store the starting position of the Camera. CameraOrigin = Camera.main.transform.position; // If no additional GameObjects have been set (to be moved when the world's Floating Origin is // recentered), set this array to be just Camera.main's GameObject. This is so that, by // default, the scene's Camera is moved when the world is recentered, resulting in a seamless // recentering of the world that should be invisible to the user. if (AdditionalGameObjects == null) { AdditionalGameObjects = new[] { Camera.main.gameObject }; } // Whenever the Camera moves, check to see if it has moved far enough that the world's Floating // Origin needs to be recentered. CameraController.OnMove.AddListener(TryMoveFloatingOrigin); }
/// <summary> /// Use <see cref="CameraController"/>'s OnMove event to detect when the <see cref="Camera"/> /// has moved far enough that the Floating Origin needs to be recentered. /// </summary> private void Awake() { // Verify a Camera Controller has been given. if (CameraController == null) { Debug.LogError(ExampleErrors.MissingParameter( this, CameraController, "Camera Controller", "to tell when the Camera has moved")); return; } // Verify that a valid Floating Origin range was given, i.e. that given distance was not // negative nor zero. Comparison is made to float.Epsilon instead of zero to account for float // rounding errors. if (FloatingOriginRange <= float.Epsilon) { Debug.LogError(ExampleErrors.NotGreaterThanZero( this, FloatingOriginRange, "Floating Origin Range", "to tell how far the Camera should move before the Floating " + "Origin is reset")); return; } // Store the initial position of the Camera on the ground plane. FloatingOrigin = GetCameraPositionOnGroundPlane(); // If no additional GameObjects have been set (to be moved when the world's Floating Origin is // recentered), set this array to be just Camera.main's GameObject. This is so that, by // default, the scene's Camera is moved when the world is recentered, resulting in a seamless // recentering of the world that should be invisible to the user. if (AdditionalGameObjects == null) { AdditionalGameObjects = new[] { Camera.main.gameObject }; } }
/// <summary> /// Use events to connect <see cref="DynamicMapsService"/> to <see cref="BuildingTexturer"/> so /// that all extruded buildings can receive a Nine-Sliced <see cref="Material"/>. /// </summary> private void Awake() { // Verify that the given Segment Physics layer is valid (positive and within the range of all // available physics layers). if (SegmentPhysicsLayer < 0 || SegmentPhysicsLayer > 31) { Debug.LogError(ExampleErrors.OutsideRange(this, SegmentPhysicsLayer, "Segment Physics Layer", 0, 31)); return; } // Convert Segment Physics Layer index into a Layer Mask for ray-casting into this layer only // (i.e. for seeing if any segments are hit by a ray-cast). SegmentPhysicsLayerMask = 1 << SegmentPhysicsLayer; // Get required Building Texturer component on this GameObject. BuildingTexturer buildingTexturer = GetComponent <BuildingTexturer>(); // Get the required Dynamic Maps Service on this GameObject. DynamicMapsService dynamicMapsService = GetComponent <DynamicMapsService>(); // See if any segment types have been given as types to remove buildings over. We check this so // that, if no segments types have been given, unnecessary setup can be avoided. bool removeAny = RemoveOverRoads || RemoveOverRailways || RemoveOverFerryLanes; // If any segment types have been given as types to remove buildings over, then sign up to event // called after each new segment is loaded, so can assign a Collider to it and place it in the // Segment Physics Layer. 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. if (removeAny) { dynamicMapsService.MapsService.Events.SegmentEvents.DidCreate.AddListener(args => { args.GameObject.AddComponent <MeshCollider>(); args.GameObject.layer = SegmentPhysicsLayer; }); } // Sign up to event called after each new building is loaded, so can store it for checking // against segments and apply a Nine sliced texture. dynamicMapsService.MapsService.Events.ExtrudedStructureEvents.DidCreate.AddListener(args => { // Store building so it can be check to be over a segment (after all segments are loaded). We // skip this if no segment types have been given as types to remove buildings over. if (removeAny) { StoreBuilding(args.GameObject, args.MapFeature); } // Assign Nine sliced texture to this building. buildingTexturer.AssignNineSlicedMaterials(args.GameObject); }); // When all geometry is loaded, check if any buildings are over any segments, and remove them if // so. We skip this if no segment types have been given as types to remove buildings over. if (removeAny) { dynamicMapsService.MapsService.Events.MapEvents.Loaded.AddListener(args => TryRemoveBuildings()); } }