Skip to content

Map Layer Features Not Always in The Right Place #1587

@highpockets

Description

@highpockets

Note: If this is a bug or support ticket, please provide the following information:

  • Unity version: 2019.3.5f1

    • Scripting Runtime Version: .NET 4.6

    • Scripting Backend: IL2CPP

    • Api Compatibility Level: .NET Standard 2.0

  • Mapbox SDK version: 2.1.1

  • The platform you're building to: iOS/Android

  • A description of what you're trying to do:

Adding a Mapbox Streets V8 map layer with roads so we can have mesh colliders on roads. Everything is ok when initializing the map/starting the game. The 'Extent Options' is set to 'Range Around Transform', thus after moving the target transform, tiles start to appear in the direction that the transform moves and the textures and road meshes appear in the new positions, but on a lot of those tiles, there is extra road mesh from, what I assume is, the previous position of the tile.

So, I tried to track down where the tiles were being redistributed and I found myself inside the AbstractMapVisualizer at the LoadTile() function, line 225. I tried to check the unityTile for children and if the tile has children, Destroy() those child objects, but that appears to be Destroying some of the new children as well:

                 public virtual UnityTile LoadTile(UnwrappedTileId tileId)
		{
			UnityTile unityTile = null;

			if (_inactiveTiles.Count > 0)
			{
				int _childCount;
				unityTile = _inactiveTiles.Dequeue();
				_childCount = unityTile.transform.childCount;

				if( _childCount > 0)
				{
					for(int i = _childCount - 1; i >= 0; i--)
					{
						Destroy(unityTile.transform.GetChild(i).gameObject);
					}
				}
			}

Here is an image to help see the issue. The pink lines are the roads that I have defined in the Map Layer features. You will notice that all streets are defined except for the primary's, trunks and motorways along with bridges which is what we want, but there are additional pink roads in random spots, like crossing the river for example.

Screen Shot 2020-04-07 at 4 50 25 PM

  • Steps to recreate the bug if appropriate:

Steps mentioned above...

  • Links to your logs are also helpful:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions