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
Unity.call overrides previous Unity.call #189
Comments
I've modified the definition of webViewObject.EvaluateJS(@"
window.Unity = {
call: function(msg) {
var iframe = document.createElement('IFRAME');
iframe.setAttribute('src', 'unity:' + msg);
document.documentElement.appendChild(iframe);
iframe.parentNode.removeChild(iframe);
iframe = null;
}
}
"); If you only need to support WKWebView and not UIWebView, you can also utilize the WKWebView's scriptMessageHandler, which is more reliable. Instead of |
Thanks the iframe method seems to work fine. I only need to support WKWebView. I would be interested in the MessageHandlers to see if there is any speed difference. Is it currently implemented? I tried window.webkit.messageHandlers.unityControl.postMessage() |
Yes, it is implemented. Please note that even if you specify |
I'm trying it in the unity editor on a mac osx sierra. Is that why it would be undefined? If I call |
Ah, sorry, it is only implemented for the iOS version. It should work on iOS devices. |
The webkit method is much faster in my tests. Thanks. |
In javascript:
Unity.call("message1");
Unity.call("message2);
only message2 is processed.
How can I get both messages to be processed?
I'm using mac editor and wkwebkit
The text was updated successfully, but these errors were encountered: