Unity Android VR Browser




This is in Beta mode. It’s been tested and works on the Oculus Go.


Open the GazePointerWebviewScene and use your head to aim and the controller’s trigger to click. Make sure the browser has pivot points set to (0.5,0.5) so click coordinates translate correctly to the Android’s WebView coordinates.

If you want to input text, connect your Oculus via usb and use the command: adb shell input text 'yourtexthere'

Importing into your own project

Copy BrowserView.cs and UnityThread.cs to your scripts directory, and unitylibrary-debug.aar(precompiled) to your Plugins/Android/ directory. Fill BrowserView.cs's public fields appropriately. You must set your Unity API version to 25 (in player settings).


Youtube does not work, see this.

The CPU draws an Android webview onto a bitmap, converts it to a png, then passes that onto a Unity RawImage. This drawing code should be transferred to the GPU as in here. You’ll see the android project is based on that but I don’t know opengl and there are some difficulties I didn’t have time to overcome on passing graphics contexts to/from Unity. ( i.e. this)

The plugin uses WebView.enableSlowWholeDocumentDraw() before inflating the view. This slows down the loading process for a webpage but it’s the only way I could scroll the view programmatically and still be able to see the webpage beyond the initial dimensions of the screen.

Please feel free to improve/fix anything and submit a PR. There’s lots of work to do!

How to edit and compile your own Java plugin

The code is in the unitylibrary module. The MainGL class is where most of the work is done, and uses the BitmapWebView’s overrided draw method to get the webpage images.

After modifying, use the gradle menu to build unitylibrary. Take the new unitylibrary-debug.aar from ⁨UnityAndroidVRBrowser⁩/⁨AndroidViewToGLRendering-master⁩/⁨unitylibrary⁩/⁨build/⁨outputs/⁨aar⁩ and move it to Assets/Plugins/Android/


use the AndroidUnity tag in logcat to see the plugin’s log output, i.e.: ./adb logcat -s ActivityManager PackageManager DEBUG AndroidUnity Unity


Add VR keyboard
Transfer rendering to OpenGL
Try replacing WebView with a GeckoView The moment I add a GeckoView Unity crashes
Test Javascript scrolling to avoid WebView.enableSlowWholeDocumentDraw()
Improve this readme
Add trackpad scrolling
General debugging (some webpages don’t work)