TLabAltoh / TLabWebViewVR

Sample Unity project for using TLabWebView in OculusQuest. Includes Meta XR SDK and XR Interaction Toolkit implementation example.
https://tlabgames.gitbook.io/tlabwebview/
MIT License
43 stars 9 forks source link

Webview to unity #13

Closed ZoedAb closed 7 months ago

ZoedAb commented 11 months ago

is it possible to addlistener to a button on the webview to execute a function in unity

TLabAltoh commented 11 months ago

Thanks for your comment.

Callbacks to functions on the unity side from the browser are currently not possible.

This system works by connecting unity and the browser with a java plugin, but this plugin does not yet have the ability to execute unity functions.

I will add it in an update in the near future.

TLabAltoh commented 10 months ago

Add sendMessage(String go, String method, String message) to the plugin.

It is made to work by executing

function() {
    com.tlab.libwebview.sendMessage(String go, String method, String message)
}

from javascript code.

See this document for the arguments.

TLabAltoh commented 9 months ago

com.libwebview.sendMessage() was not working, so we fixed the plugin. The code for sending messages from js to Unity has been changed as follows.

Function() {
    window.TLabWebViewActivity.unitySendMessage(String go, String method, String message)
}