IanPhilips / UnityOculusAndroidVRBrowser

3D browser based on GeckoView and Oculus SDK for Unity projects built on Android (Oculus Go/Quest, maybe GearVR)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Receiving a message from browser.

srcnalt opened this issue · comments

Hi,

I was wondering if it's possible to receive a message from web content to Unity project with the plugin.

Seems like this is kind of related to this question here #13

Receive a message? What type of message? The Gecko Engine passes information back to Unity via callbacks, defined here on the java side and redefined (not DRY I know :( but I think this is the only way to do it) on the receiving end here on the C# side.

Hi, what I mean is sending a message to Unity, from the browser.

I am using unity-webview repo for displaying a browser window in Android and IOS apps, however it does not support VR. I was looking for alternatives and came up with this project which works perfect!

In unity-webview the user can add a line of code into their webpage, such as Unity.call("message") and this message is captured by the plugin and served to user. I was wondering if something similar would be possible here.

I suppose this is done by somehow parsing the javascript in the page and injecting a functionality to a certain Unity object in there.

Ohhh right right, this is complicated. What you want to do is interact with GeckoView/one of its components from javascript. That should give you the right search queries. This may be of use.

Thank you, I'll give it a read.

Looks like #41 used WebExtension for this