When building a Unity program for web (WebGL), mostly we need to access methods/functions inside Unity from JavaScript (browser scripting).
This example is showing how it can be done. In this example I’m showing how to call JavaScript alert from Unity and then send back some string text to Unity Scene from web browser.
Watch the video here:
And get all the files here: https://drive.google.com/open?id=1rWFj26l1P0ut9W6Kc0HU0GpJzW6DVxTJ
but i am not getting keyboard input after this
I think it is disabled in the bridge script in the start function
Hmm.. not sure
Make sure you have this javascript code at the bottom of your html:
var recaptureInputAndFocus = function() {
var canvas = document.getElementById(“#canvas”);
if(canvas) {
canvas.setAttribute(“tabindex”, “1”);
canvas.focus();
} else
setTimeout(recaptureInputAndFocus, 100);
}
recaptureInputAndFocus();