00:00
00:00
Newgrounds Background Image Theme

Someone gifted MetalSlayer69 supporter status!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!
Response to: Unity3d WebGL Support Posted July 23rd, 2015 in Game Development

I struggled a bit today getting keyboard input working properly in Unity WebGL on Newgrounds, but finally have it working.

There's a couple of issues which might trip you up here.

Firstly, Unity's Input.inputString doesn't seem to work at all at the moment, so if you're using that you'll have to scan the keys using Input.GetKeyXXX.

Secondly, since NG hosts the game in an iframe, there's an issue with not having the focus set so that the game can receive key input.

You can fix this by changing index.html and adding the following to the <canvas> element:

onclick="window.focus()"

And also by adding this <script> block inside <body>:

<script>
    window.onload = function() { window.focus(); }
</script>

Hope this helps!

Response to: Best of October 2013 Posted November 12th, 2013 in NG News

Wooo, Accelerator was 7th! That's something, right?! :D