mapbox / mapbox-unity-sdk

Mapbox Unity SDK - https://www.mapbox.com/unity/
Other
722 stars 214 forks source link

NullReference : Switching active state of feature layers at runtime #1800

Open Markovicho opened 3 years ago

Markovicho commented 3 years ago

Hey @brnkhy,

i already reported this minor issue regarding the persistance of the feature-layer name in editor. I discovered something more critical and combined it in this post as it probably is correlated:

Issue 1:

Adding a map feature layer will result an editor script to throw an indexoutofbounds expection:

image

image

Renaming feature layer not persisting

Renaming the layer will not persist when entering play more. After playmode was active the layer is renamed back to "Untitled". Maybe this is caused by the same reason of the above indexoutofbounds exception (?)

Issue 2:

So far no really big issue. But enabling / disabling layers at runtime will cause nullreferences at the following line in VectorLayerVisualizer.cs

mergedStack.End(tile, tile.gameObject, layer.Name); // NULLREF caused by access of layer.Name 

image

i can reproduce this issue by simply checking / unchecking the layer in the editor or calling it via script. it's not happening all the time

brnkhy commented 3 years ago

@Markovicho I recently started looking into vector layer properly and this might be a good starting point. I had toggle vector layer in mind but of course toggling layers actually makes much more sense and probably more useful/common use case. I'll try to get back to you on this soon.