Search Issue Tracker
Fixed in 2021.1.X
Votes
3
Found in
2018.4
2020.1.4f1
2021.1
Issue ID
1283206
Regression
No
[WebGL][Android] Gyroscope does not work relative to the device view orientation on Android WebGL
Reproduction steps:
1. Create a new project and Import the attached custom Package "gyronotworking.unitypackage"
2. In the Project window under "Assets/Scenes" open "SampleScene.unity" and switch to WebGL Platform
3. Build for WebGL
4. Create a server using this "python -m http.server" command in the Command Prompt
5. Navigate to the built WebGL page on your Android device using your IPV4 address
6. Rotate the device for the view orientation to change
Expected result: Gyroscope works relative to the device view orientation
Actual result: Gyroscope does not work relative to the device view orientation
Reproduced on these devices:
N/A, Samsung Galaxy S9 (SM-G960F), Android 8.0.0, CPU: Exynos 9 Series 9810, GPU: Mali-G72
N/A, Lge LG V50 ThinQ (LM-V500N), Android 10, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640
VLNQA00316, Samsung Galaxy Note10 (SM-N970F), Android 9, CPU: Exynos 9 Series 9825, GPU: Mali-G76
Reproduces on: 2018.4.28f1, 2019.4.12f1, 2020.1.8f1, 2020.2.0b7, 2021.1.0a1
-
Marks4
Oct 14, 2020 00:04
The WebAPI already covers gyroscope. Take a look at the following:
1- https : / / developer . mozilla . org/en-US/docs/Web/API/DeviceOrientationEvent
2- https : / / developer . mozilla.org/en-US/docs/Web/API/DeviceMotionEventI believe the 2 APIs above should cover the javascript bindings.
One important thing to notice, is that on iOS 13 onwards, permission needs to be requested to access the gyroscope, and the request must be initiated with a user gesture.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Crash on GizmoDrawingPhysics2D::DrawCompositeCollider2DGizmo when opening a Scene that has corrupted GameObjects with Tilemap Components
- Scrolling vertically and horizontally is very fast when in Play Mode and RuntimeInputBackend is set to UIToolkitInputBackendOption.Default
- Crash on MemoryProfiler::UnregisterAllocation when initializing entities and leaving Play Mode with Occlusion Culling enabled
- Crash on mdb_page_alloc when opening a project that was running while the PC shut down
- macOS Player freeze when using RunInBackground and Command+Tabbing to and from the application
Resolution Note (fix version 2021.1):
Support for Gyroscope, Accelerometer for WebGL builds running on mobile devices is planned to be included in a future release of Unity. Please check the release notes for the next major Unity release for details.