sdk3 LocationBasedGame has errors when running
Unity Version: 2022.3.62.f2 OS: Ubuntu 24.04.03
Steps to reproduce
-
git clone https://github.com/mapbox/mapbox-unity-sdk.git - cd into mapbox-unity-sdk project repo and run
git switch sdk3 - In Unity Editor, Package Manager > Add From Disk > Select package.json from mapbox-unity-sdk project
- In the Package Manager select Download Sample for LocationBasedGame
- Try to target android
I get the following errors: Projects/MapBoxSDK/mapbox-unity-sdk/Runtime/Mapbox/MapDebug/Scripts/Logging/Editor/LoggingCacheManagerBehaviourEditor.cs(11,67): error CS0234: The type or namespace name 'Editor' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
Projects/MapBoxSDK/mapbox-unity-sdk/Runtime/Mapbox/MapDebug/Scripts/Logging/Editor/LoggingCacheManagerBehaviourEditor.cs(10,6): error CS0246: The type or namespace name 'CustomEditorAttribute' could not be found (are you missing a using directive or an assembly reference?)
Projects/MapBoxSDK/mapbox-unity-sdk/Runtime/Mapbox/MapDebug/Scripts/Logging/Editor/LoggingCacheManagerBehaviourEditor.cs(10,6): error CS0246: The type or namespace name 'CustomEditor' could not be found (are you missing a using directive or an assembly reference?)
Projects/MapBoxSDK/mapbox-unity-sdk/Runtime/Mapbox/MapDebug/Scripts/Logging/Editor/LoggingDataFetchingManagerBehaviourEditor.cs(8,74): error CS0234: The type or namespace name 'Editor' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
Projects/MapBoxSDK/mapbox-unity-sdk/Runtime/Mapbox/MapDebug/Scripts/Logging/Editor/LoggingDataFetchingManagerBehaviourEditor.cs(7,6): error CS0246: The type or namespace name 'CustomEditorAttribute' could not be found (are you missing a using directive or an assembly reference?)
Projects/MapBoxSDK/mapbox-unity-sdk/Runtime/Mapbox/MapDebug/Scripts/Logging/Editor/LoggingDataFetchingManagerBehaviourEditor.cs(7,6): error CS0246: The type or namespace name 'CustomEditor' could not be found (are you missing a using directive or an assembly reference?)
thank for the report @avenmia !
looks like I forgot to add assembly definition for the editor folder there. fixed that and pushed to sdk3 branch directly, it should build now. please let me know if you run into any issues.
np!
I ran git pull on the sdk3 branch and tried build and run on my android (Samsung Galaxy S23), but now I'm getting "MapboxDemo closed because this app has a bug. Try clearing the app's cache first, and then reopen the app." It still keeps closing right away after I selected clear cache.
@avenmia I'm not familiar with such an error message, is there anything in logcat?
I'm not getting any logcat errors because the app isn't launching when I deploy to my phone. It does say the app builds successfully and it seems to work when I launch it in the unity editor.
Here is what I'm seeing in the unity editor.
These are the build settings I'm using:
On my device, I did briefly get an error saying it wasn't compatible with the latest version of Android so I'm currently investigating that. My phone is running Android 16. Most of the time when I click the deployed MapBoxDemo I get a "The app has a bug" error.
I tried setting it to development build and "Wait for managed debugger" but the debugging screen isn't even coming up.
I'll hopefully have more time this weekend and can let you know if I get farther.
I got farther, the problem was I forgot to copy the plugin folder as this step describes. https://github.com/mapbox/mapbox-unity-sdk/tree/sdk3dev?tab=readme-ov-file#building-your-map-application-for-android
The location game now launches, but gets stuck on the loading screen. The logs suggest a null reference exception which I'm still looking into.
I'm getting an argument cannot be null exception. I'm checking to see if I missed another set up step
2025/11/15 10:28:44.406 28948 28981 Error Unity ArgumentNullException: Value cannot be null.
2025/11/15 10:28:44.406 28948 28981 Error Unity Parameter name: shader
2025/11/15 10:28:44.406 28948 28981 Error Unity at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x0000a] in /home/bokken/build/output/unity/unity/Runtime/Export/Shaders/Material.bindings.cs:18
2025/11/15 10:28:44.406 28948 28981 Error Unity at Mapbox.Example.Scripts.Map.MapboxMapBehaviour.CreateMapVisualizer (Mapbox.BaseModule.Map.IMapInformation mapInfo, Mapbox.BaseModule.Unity.UnityContext unityContext) [0x0002d] in /home/avenmia/Projects/MapBoxSDK/mapbox-unity-sdk/Runtime/Mapbox/Example/Scripts/Map/MapboxMapBehaviour.cs:113
2025/11/15 10:28:44.406 28948 28981 Error Unity at Mapbox.Example.Scripts.Map.MapboxMapBehaviour.CreateMapObject () [0x0002b] in /home/avenmia/Projects/MapBoxSDK/mapbox-unity-sdk/Runtime/Mapbox/Example/Scripts/Map/MapboxMapBehaviour.cs:94
2025/11/15 10:28:44.406 28948 28981 Error Unity at Mapbox.Example.Scripts.Map.MapboxMapBehaviour.Initialize () [0x00059] in /home/avenmia/Projects/MapBoxSDK/mapbox-unity-sdk/Runtime/Mapbox/Example/Scripts/Map/MapboxMapBehaviour.cs:53
2025/11/15 10:28:44.406 28948 28981 Error Unity at Mapbox.Example.Scripts.LocationBehaviours.SnapMapToLocationProvider.<Start>b__5_0 (Mapbox.LocationModule.Location
I believe I'm missing the ShaderGraphs/ElevatedTerrainShader