Sensor Camera — Unity Asset that uses a Motion Sensor (Gyroscope or Accelerometer) on the player’s mobile device to control the game camera from a first-person view (just like in FPS Games). Safety First.
With adding live video input from the Back/Rear Camera of a Mobile Device, Sensor Camera can be used as a “Pseudo AR Camera” to display 2D or 3D objects as though they were in the real world.
But Why is WebGL only available for Android? Because the Unity WebGL platform has a bug on iOS in Safari and Chrome with Orientation Changing:
when you change device orientation during the game, then it is not defined correctly sometimes. Solution: warn the player about making correct orientation before starting of Unity Project on a new tab.
At the same time, I tested a standalone app on the iOS platform: works like a charm!
All Tested Platforms are here:
Mobile Platforms with Motion Sensors:
iOS on iPhone 8, XS Max;
Android on Samsung Galaxy A71;
WebGL (Android) in Google Chrome.
Desktop Platforms with Right Mouse Button (for those who want a similar and seamless experience on all platforms):
Today, I submitted 2 Bug Reports to Unity related to the next issues:
[WebGL > iOS]: Incorrect Orientation Changing, which leads to publishing without issues to the [WebGL > Android] platform only, as well as to iOS and Android platforms [standalone].
Resolving this bug by Unity will lead to the opportunity to publish WebGL apps for iOS.*
[iOS]: Delay and Freezing in Unity’s New Input System related to the Attitude Sensor. This bug doesn’t influence the asset because for iOS and Android standalone platforms it uses Input Manager instead (Unity’s Input System by Default).
But resolving this bug by Unity will lead to further asset upgrading and smooth development.*
Bug Reporting took several hours.
For your clear understanding, Working Platforms with Motion Sensors at this moment:
iOS on iPhone 8, XS Max;
Android on Samsung Galaxy A71;
WebGL (Android) in Google Chrome.
I continue to work, stay tuned. The Unity Asset is Here: Sensor Camera.
I released the Sensor Camera 2.1 for Unity 2022.3.18 with WebGL Support via HTTPS for iOS
The bug with orientation changing was fixed by Unity without confirmation. The previous state of bug was “Won’t Fixed”. Today I updated the ticket in Unity’s Jira and status was changed to “Active”.
I tested with Google Chrome on iPhone XS Max, Unity 2022.3.18, Input System 1.7.0 and my Sensor Camera asset. I can see that orientation changes to correct orientation after setting the wrong orientation. So the problem was resolved.