Geolocation doesn't work on WebGL

I just modified the script here: Unity - Scripting API: LocationService.Start to show the information on the canvas instead of the console.

What it should happen, is ask the user for permission, and then retrieve the data. But it doesn’t, it just shows a bunch of 0’s. The geolocation api is supported by all major browsers: Geolocation API - Web APIs | MDN . This should work.

1 Like

Thanks for the report! Can you raise your test case as a bug? Also which Unity version were you on?

I did file a bug report, but it’s not on the issue tracker yet. I tested with Unity 2020.1 (sorry, I didn’t test with a later version because I often have problems with the build hanging, see this post), but I’m pretty sure it won’t work on Unity 2020.3 and later either. I will post the link to the issue tracker once it’s available.

Thanks, very much appreciate your efforts! Agreed, if it did not work on 2020.1, it won’t work on 2020.3, since I am not aware of us landing any geolocation related improvements to the tree between that time frame.

2 Likes

Yikes the il2cpp.exe hang seems a bit nasty. Commented on the thread.

1 Like

@jukka_j issue tracker

1 Like

Great, thank you so much for the report!

1 Like

@jukka_j I got this reply regarding the issue:

This wording might not be the best but what it means is: We added this as a feature request to our development backlog and are planning on adding it to a future Unity version. The fogbugz case got closed since it is not a bug as such.

Hello,

I know this is a old thread, but the feature (geolocation) has been added?
Thanks

1 Like

I’m curious to know as well… however, for the time being, anything technically possible in JavaScript can already be done within WebGL builds :slight_smile:

No reply…

I made a plugin for this.