-
Notifications
You must be signed in to change notification settings - Fork 690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invoke unity function from Javascript or listen/trigger from redirect http response #220
Comments
The sample app shows how to interract between Unity and HTML. If you want to call the Unity-side, you can utilize
If you want to call the JavaScript-side, you can utilize
|
Hey! Thanks for the quick and prompt reply! |
Yes, it behaves as you noted. So you can communicate between Unity and HTML (JavaScript) in both directions. |
Thanks a lot! Easy and simple. I'm about to use it in production. Are you aware of any limitations on iOS / android ? Does it support Android SDK >=15 and iOS >=8? Cheers |
Yes, it should run well on android with API version 15 or later and iOS 8 or later. |
what is a production ready pre-processor flag for android and iOS. The sample app uses:
But that doesn't work on android at all.
Work in any case for android >15 and ios>8. Or what do you suggest? When calling LoadURL(), is there a way to clear the webview (show white while loading) instead of showing the previous website until it finishes loading ? I saw you were referencing this issue: #189 |
The sample app doesn't define unity-webview/sample/Assets/Scripts/SampleWebView.cs Lines 49 to 74 in e5f1576
because unity-webview/plugins/Android/src/net/gree/unitywebview/CWebViewPlugin.java Lines 60 to 63 in e5f1576
You could utilize |
Thank you!!! That means it should work without the injection for android, so I can use the compiler flag, and therefore only inject it through EvaluateJs for iOS or does it do a similar thing for iOS? At the moment it works fine with your sample.html but the same call on my page isn't fired. Any tipps on how to debug ? |
The injection is required only for iOS. If you only utilize WKWebView (by specifying
Yes, it also works because |
Hey there! Awesome work.
I was wondering if there is a way to listen to javascript function and invoke a unity function.
I couldn't find a documentation. Any hints ?
I would like to build a user login form and a short quizz and use that in my webview. I need to somehow listen to the submit event and close the webform. Or can i register to redirects ? For example close the webview when a certain response is returned.
Do I have to work with the init function I suppose ? I assume I can use cb - > call from JS. Do you have a JS sample that would trigger cb?
Thanks!
The text was updated successfully, but these errors were encountered: