mapbox / mapbox-unity-sdk

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

Destroying Assets error when switching scene #1840

Open Tobbelobben opened 2 years ago

Tobbelobben commented 2 years ago

I am using Mapbox SDK for our location based game and it is working nicely, but I recently encountered an error. When switching away from the map scene, I get four "Destroying assets is not permitted to avoid data loss" errors. The stacktrace does not provide an indication of what is wrong. I am using the Mapbox map with location provider as shown in the PocketDroidsGo youtube tutorial.

errors Error log: https://pastebin.com/BQdU1Hbr

Unity version: 2021.1.21f1 Scripting Runtime Version: ? (doesnt say) scripting backend: mono api compatibility level: .NET standard 2.0 Mapbox SDK version: v2.1.1 Bulding to: just running in unity editor

brnkhy commented 2 years ago

that error occurs when code tries to destroy a prefab which isn't created using instantiate method. so when you try to destroy the original instead of an instantiated clone. first of all, are you sure that's not happening in you custom code? any chance you are using some objects without instantiation?

Tobbelobben commented 2 years ago

Hey, the error is coming from MapboxSDK/Unity/DataContainers/GeometryMaterialOptions line 269. So it is not my own code. Under is the function that produces the error: image

brnkhy commented 2 years ago

@Tobbelobben ah I see. I'm afraid that material loading system is faulty all together and I cannot look into that any time soon. are you using styled buildings (realistic etc)? does it also happen when you use a basic style for example? I think this won't be easy but maybe we can find a way to avoid that system altogether to achieve the visuals you want.

Tobbelobben commented 2 years ago

We have been used styled buildings, but the problem seems to be happening also without them, like when just using normal streets map.