1 (edited by mattattack1000 2019-05-23 17:25:25)

Topic: Map Not Loading (Just a Black Background) on Android in Unity 2019

I'm using Unity 2019.1.3 and I also tested Unity 2019.1.1, so it's a Unity 2019 problem with Online Maps. As the title describes, when the application is exported to an android device the map provider and type (not custom) appears to reset to some default value, so the map doesn't load as a result and is just black. Everything else functions properly as far as I can tell.

Last time it was successfully working was in Unity 2018.3.4 (I haven't tested Unity 2018.4 but I'm sure it works here too). So the problem is it no longer works properly in Unity 2019. All recent versions of Online Maps let me export to Android properly in 2018.3.4 but not 2019.1.X. I've narrowed it down to this, so it should be easily reproduce-able. My provider I've chosen is OpenStreetMap with the type Mapnik.

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

I no longer think it's the map provider type, but something is causing the map to be black. My reasoning for this is I debugged the map type on the Android device and it was the same, and I can find the correct map tiles cached in the files.

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

Hello.

I just made a build using Unity 2019.1 and tested it on the device. OSM / Mapnik is displayed correctly.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

Okay thanks, I will look into other potential causes. If I think it's not Online Maps related anymore I'll remove the post.

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

So I have done some more testing. It exported with no issues for my iPhone 7, but still does not work in Unity 2019.1.X for my Android device. I downgraded the project version to Unity 2018.4 and it worked perfectly. I don't have another Android device to test on so maybe it's very specific to my phone's software (Android 8.1) and or hardware (the phone is a Moto G5) when OnlineMaps is using Unity 2019.1.X. So, it seems highly unlikely that it is anything other than Online Maps and Unity 2019 causing the problem (maybe not for all Android devices but specific ones).

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

Any idea on why it might be displaying a black background instead of the map given the testing I've done?

7 (edited by mattattack1000 2019-05-23 17:21:07)

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

The problem has been fixed. It turns out that it was the Auto Graphics API setting in Unity. I started a new build with Online Maps freshly installed and I noticed in the Player Preferences for Android this option was not checked and was using Vulkan and OpenGLES3 for Graphics APIs. In my project after I unchecked the Auto Graphics API option, removed OpenGLES2, and added Vulkan and OpenGLES3 it worked. However, if I checked the Auto Graphics API again after adding those it still didn't work, so I just left it unchecked (in case someone else has this problem). This was a very weird problem, and as it turns out, not a bug with Online Maps.

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

Auto Graphics API is the last place that I would have thought that this would cause problem.
Thank you for sharing the results of the search problem.
I will keep my finger on the pulse, and if someone else has such a problem, I will add it to the documentation.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

9 (edited by mattattack1000 2019-05-23 20:40:16)

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

It is also the last place I thought that would cause a problem like this. I've been working on finding a solution for a couple days now, so I'm more than happy to share what helped me get it to work. It appears that it needs the Vulkan API to be at the top of the Graphics API list for it to work on the Moto G5. An image of the settings is attached.
https://i.imgur.com/b3UgmLi.png

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

Hi, I am having the same problem when using OpenStreetsMaps with Mapnik type.
When building for a Xiami mi5s with Android 6 the map is shown correctly but when building for a Samsung A30 and a Xiaomi Pocophone (both with Android 9) the map appears grey but I can see some markers that I have drawn. I am using Unity 2019.1.0f2

I think it is a graphic problem because I'm drawing some markers and those markers are showing correctly in all phones, I can even zoom and move the map.

The weird thing is that if I change the type to France it works correctly on all phones.

Also in my case changing to the Vukan API didn't fix the problem. I'm going to see if changing the project to the Unity 2018 fixes the problem.

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

Changing to the 2018.4 didn't fix the problem, going to try to change to the 2018.3.11 to see if it fixes it.

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

Hello.

I see your messages, but I really do not know what to say, because the problem is not reproduced on my devices.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

If the map is grey it probably means that you aren't connected to the internet with your phone, so the tiles aren't downloaded. The black map problem is a completely different issue as far as I know.

Re: Map Not Loading (Just a Black Background) on Android in Unity 2019

It's ok I fixed it by changing the Map provider.

It's not an internet problem because I'm requesting a route to ORS and the route is being displayed correctly, also if I change to the France map style instead of Mapnik it works.

I tried to find what was the difference but both style requests (Mapnik and France) retrieve tiles of 256x256 png of similar size, the only noticeable difference was the time it took to get them, in the Mapnik case it was a bit longer. (Is there maybe a timer that is timing out? I'm doing the requests from Spain maybe there is too much ping and that's the reason why the France style works? I don't know.) (In the Unity editor it works with the Mapnik, anyway)

To replicate this I just had to create a new Unity Project with version 2019.1.4f add the OnlineMapsv3 from the asset store (Version 3.2.1.1) add the Demo scene to the build settings, build for Android and deploy in mobile. When executing the app the grey screen appears when the selected style was mapnik. I even added a button to change to the France style in runtime and after changing it and refreshing the map it was rendered correctly. Very weird stuff...