- Home /
Unity5 WebGL gyroscope access
Hello everybody,
I want to make a WebGL demo for Google Cardboard with Unity5.
Is there a way to access the gyroscope from a Unity5 WebGL Application running in Android or IOS browser? It works fine as Android Application, but I want to access it from a Android device via the web browser and without a Plugin.
Alternatively I consider to use an external javascript library and transfer the sensordata to Unity. In the web player I used Application.ExternalCall to call a javascript function and unity.SendMessage() to send a message from javascript to Unity. How can I send messages from a Unity WebGL Application to the embedding Website and vice versa?
Hints or sample code would be great!
many thanks, klap
I'm currently having the same problem. $$anonymous$$y android can't run the index.html. Is WebGL-Export for mobile browsers planned to be implemented in the future?
@schubkraft do you know if this will ever be supported? There are other webgl sites out here that currently support gyro via the mobile browser.
I'm sure once we are extending our support to mobile browsers the gyro will be part of it. But there are no timelines attached to this, sorry.
Answer by Schubkraft · Apr 20, 2015 at 11:49 AM
Mobile browsers and devices are currently not supported by our WebGL export.
Afaik you can't get the gyroscope from WebGL atm.
For script interaction see the manual at http://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html
Answer by patrik-org · Sep 26, 2021 at 08:45 PM
You can get through javascript interop as shown in sama-van's answer here:
https://forum.unity.com/threads/can-webgl-access-mobile-sensors.332566/
Your answer
![](https://koobas.hobune.stream/wayback/20220613190430im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can Unity WebGL access mobile sensors? 1 Answer
WebGL: Scroll Camera 0 Answers
[WEBGL] PLAYER CONTINUES TO RUN AFTER WEBGL-CONTENT IS REMOVED FROM DOM 1 Answer
Unity 4 compatibility to Unity 5 WebGL 1 Answer
UNET with own server 0 Answers