Skip to content

Performance tip: Determine layers to load dynamically #37

@erikvullings

Description

@erikvullings

Currently, you specify in Unity (TileManager script) the layers to load. Alternatively, you could determine them automatically, so the user will never load more layers than he actually needs, based on the XmlTags that are in use. I.e.

In TileManager.cs:

  • I've removed the readonly and [SerializeField] of _mapzenLayers
  • after loading the plugins in InitFactories() I've added a call to InitLayers()
        private void InitLayers()
        {
            var layers = new List<string>();
            foreach (Factory plugin in _plugins)
            {
                if (layers.Contains(plugin.XmlTag)) continue;
                layers.Add(plugin.XmlTag);
            }
            _mapzenLayers = string.Join(",", layers.ToArray());
        }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions