00:00
00:00
Newgrounds Background Image Theme

Manvineo just joined the crew!

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!

Unity3d WebGL Support

65,716 Views | 123 Replies
New Topic Respond to this Topic

Having problems with your Unity3D WebGL game? Please start here. If you've read through the wiki, searched Google, etc. and still haven't resolved your issue, feel free to ask a question here.

Response to Unity3d WebGL Support 2015-05-13 16:24:36 (edited 2015-05-13 16:26:00)


At 5/13/15 12:02 PM, PsychoGoldfish wrote: You can add other key codes to the ignore_keycodes array as needed.

Is there a way to do this to ignore scroll wheel inputs? In flash, you have to send js to the browser, and it doesn't work on every browser or every OS.

I don't use js or html5 so I wouldn't know if it was obvious. It'd be something I add post-haxe output.

Response to Unity3d WebGL Support 2015-05-13 19:39:44


At 5/13/15 04:24 PM, MSGhero wrote:
At 5/13/15 12:02 PM, PsychoGoldfish wrote: You can add other key codes to the ignore_keycodes array as needed.
Is there a way to do this to ignore scroll wheel inputs? In flash, you have to send js to the browser, and it doesn't work on every browser or every OS.
I don't use js or html5 so I wouldn't know if it was obvious. It'd be something I add post-haxe output.

I updated the original post with a scrollwheel example for you. Basically you can create a javascript event listener function for damn near any event. The first parameter passed to the function (using 'e' in these examples) will be an event object. Telling that object to preventDefault will stop it from preforming it's default browser behavior.

There's a pretty extensive list of javascript events at https://developer.mozilla.org/en-US/docs/Web/Events

Response to Unity3d WebGL Support 2015-06-02 12:43:15


WebGL is not meant to actually be used right now. It creates massive flaws that completely break gameplay. Also if you're trying to use it on chrome it refuses to read arrow key inputs for some reason.

Response to Unity3d WebGL Support 2015-07-23 02:06:10


Our webgl game is almost working perfectly on NG. But our save data is not saving! Apparently an iFrame issue? Is there any way we can get our game to save data?

Response to Unity3d WebGL Support 2015-07-23 14:08:01


At 7/23/15 02:06 AM, D-SuN wrote: Our webgl game is almost working perfectly on NG. But our save data is not saving! Apparently an iFrame issue? Is there any way we can get our game to save data?

Are you getting any errors in the developer console?

Response to Unity3d WebGL Support 2015-07-23 14:29:11


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 Unity3d WebGL Support 2015-07-23 22:19:06


At 7/23/15 02:08 PM, BrenTheMan wrote:
At 7/23/15 02:06 AM, D-SuN wrote: Our webgl game is almost working perfectly on NG. But our save data is not saving! Apparently an iFrame issue? Is there any way we can get our game to save data?
Are you getting any errors in the developer console?

Yup, PlayerPrefs won't be saved.

Here is a screenshot.
http://www.sun-studios.net/other/imagedump/july2015/Error.PNG

Response to Unity3d WebGL Support 2015-07-23 22:55:46


At 7/23/15 10:19 PM, D-SuN wrote: Yup, PlayerPrefs won't be saved.

Any other info? Can you click that triangle toggle next to the warning message?

Response to Unity3d WebGL Support 2015-07-24 00:17:02


At 7/23/15 10:55 PM, BrenTheMan wrote:
At 7/23/15 10:19 PM, D-SuN wrote: Yup, PlayerPrefs won't be saved.
Any other info? Can you click that triangle toggle next to the warning message?

Odly, this seems to not be an issue anymore :S

We've published out game, as the save data is now working. If I figure out why this has occured, then I'll do a post here for other to refer to.

Response to Unity3d WebGL Support 2015-07-30 20:36:21


I just enabled NPAPI so that I could play Unity games on Chrome here on NG. After relaunching Chrome with this enabled if I go to a Unity game it never loads. More specifically - the window where the game should be is just completely gone... It just shows the games description and then the comment section on the webpage. Why is that?

Response to Unity3d WebGL Support 2015-07-30 20:43:32


At 7/30/15 08:36 PM, Hero101 wrote: I just enabled NPAPI so that I could play Unity games on Chrome here on NG. After relaunching Chrome with this enabled if I go to a Unity game it never loads. More specifically - the window where the game should be is just completely gone... It just shows the games description and then the comment section on the webpage. Why is that?

This isn't the right thread for that. Post in the Help forum and make sure to link the game that you're having problems with.

Response to Unity3d WebGL Support 2015-08-21 09:53:39


All WebGL games I have tried (including mine) still requires Unity Web Player to be loaded though... :-)

Response to Unity3d WebGL Support 2015-10-12 23:12:08


is templatedata necessary? the file (zip) was uploaded successfully but the preview doesn't work.
templatedata is missing in my zip but it is no need in the new version is it?

Response to Unity3d WebGL Support 2015-10-14 01:28:24


At 10/13/15 10:24 PM, One-Eyed-Jack wrote: I Usaully don't ask these things, But I Need to know...

So, I Made this game in unity. But I Need to know before I upload. What is better? Webplayer? Or WebGL?
I Know webGL Allows Google Chrome users to play it too, Which is why I'm leaning more towards it. But I'm worried about graphics....

What do you guys think?

You can test both in the project preview before you publish it to the website

Response to Unity3d WebGL Support 2015-10-21 02:11:27


Can we Use Flash ADS in WEBGYL game in Unity

Response to Unity3d WebGL Support 2015-10-21 04:42:48


At 10/21/15 02:11 AM, ArsalanKhan wrote: Can we Use Flash ADS in WEBGYL game in Unity

No Flash Ads are for Flash games/movies...

Response to Unity3d WebGL Support 2015-12-06 14:51:27


Do you guys find that fewer people play or comments on games made in the webplayer / webgl on Newgrounds?


I'd love feedback on my endless runner - Just Duck It.

Response to Unity3d WebGL Support 2015-12-07 12:43:40


At 12/6/15 02:51 PM, Grenadetree wrote: Do you guys find that fewer people play or comments on games made in the webplayer / webgl on Newgrounds?

If you look at the under judgement games ( http://www.newgrounds.com/games/under_judgment ), there's a lot of old Unity Web Player games in there that haven't even gotten enough votes to be fully included in the portal. This is primarily die to Chrome no longer supporting it. It was for that reason, we removed support for future unity web player games, opting to only support WebGL stuff. So yeah, there is definitely less people playing those unity web player games,

As for the WebGL stuff, that really seems to depend. There have been a few games made with Unity WebGL that got fairly popular, while some just haven't gained traction. I know I, personally, can't even run most WebGL games due to the insane amount of memory they require. Unity's WebGL implementation is currently very inefficient, so those games really don't work for people with lower end hardware.

I've been told they are working hard on making things better, but at this point it's really hard to even recommend using Unity for web-based content at all, when there are so many other options available.

Response to Unity3d WebGL Support 2016-01-20 12:33:26


plz help me the keys w, a, s, d. dont work. this is a huge problem because it makes my player unable to move.

Response to Unity3d WebGL Support 2016-01-27 12:36:33


At 5/12/15 12:04 PM, PsychoGoldfish wrote:
Having problems with your Unity3D WebGL game? Please start here. If you've read through the wiki, searched Google, etc. and still haven't resolved your issue, feel free to ask a question here.

Unity3d WebGL Support

Response to Unity3d WebGL Support 2016-02-13 02:49:32 (edited 2016-02-13 02:50:15)


At 1/27/16 12:36 PM, JokingKitten119 wrote:
At 5/12/15 12:04 PM, PsychoGoldfish wrote: Having problems with your Unity3D WebGL game? Please start here. If you've read through the wiki, searched Google, etc. and still haven't resolved your issue, feel free to ask a question here.

Can you do html on the iPad mini 1?

Response to Unity3d WebGL Support 2016-02-13 13:39:53


Hey there... where do i go to get help figuring out how to get newgrounds to run .SB2 files?

Response to Unity3d WebGL Support 2016-03-08 10:32:45


Hello there!

We made game in WEBGL in unity:

However we got this error while loading the game:
Uncaught SyntaxError: Unexpected token ILLEGAL blob:http%3A//uploads.ungrounded.net/a64b28e3-c43e-471a-affa-

Now I'm pretty much stuck, because I dont know what to do with this error
anyone got any idea?

Response to Unity3d WebGL Support 2016-03-08 10:49:24


At 3/8/16 10:32 AM, Railman85 wrote: Hello there!

We made game in WEBGL in unity:
http://www.newgrounds.com/projects/view/934397
However we got this error while loading the game:
Uncaught SyntaxError: Unexpected token ILLEGAL blob:http%3A//uploads.ungrounded.net/a64b28e3-c43e-471a-affa-

Now I'm pretty much stuck, because I dont know what to do with this error
anyone got any idea?

Are you uploading the compressed version of the game, or the uncompressed? I *THINK* that error is related to trying to decompress a file that's not compressed, or is double compressed.

Response to Unity3d WebGL Support 2016-03-08 15:22:39


At 3/8/16 10:49 AM, PsychoGoldfish wrote:
At 3/8/16 10:32 AM, Railman85 wrote: Hello there!

We made game in WEBGL in unity:
http://www.newgrounds.com/projects/view/934397
However we got this error while loading the game:
Uncaught SyntaxError: Unexpected token ILLEGAL blob:http%3A//uploads.ungrounded.net/a64b28e3-c43e-471a-affa-

Now I'm pretty much stuck, because I dont know what to do with this error
anyone got any idea?
Are you uploading the compressed version of the game, or the uncompressed? I *THINK* that error is related to trying to decompress a file that's not compressed, or is double compressed.

thank you for your answer.
Starting with Unity 5.3 unity WEBGL files are compressed now by default. (they dont put .htacces files anymore).

I just got files:
dogar.datagz
dogar.jsgz
dogar.memgz
UnityLoader.js
All compressed.

You are right, that sound like some problem with compression - got any hint what to do next/what to read?

Response to Unity3d WebGL Support 2016-03-08 17:16:49


At 3/8/16 03:22 PM, Railman85 wrote:
At 3/8/16 10:49 AM, PsychoGoldfish wrote:
At 3/8/16 10:32 AM, Railman85 wrote: Hello there!

We made game in WEBGL in unity:
http://www.newgrounds.com/projects/view/934397
However we got this error while loading the game:
Uncaught SyntaxError: Unexpected token ILLEGAL blob:http%3A//uploads.ungrounded.net/a64b28e3-c43e-471a-affa-

Now I'm pretty much stuck, because I dont know what to do with this error
anyone got any idea?
Are you uploading the compressed version of the game, or the uncompressed? I *THINK* that error is related to trying to decompress a file that's not compressed, or is double compressed.
thank you for your answer.
Starting with Unity 5.3 unity WEBGL files are compressed now by default. (they dont put .htacces files anymore).

I just got files:
dogar.datagz
dogar.jsgz
dogar.memgz
UnityLoader.js
All compressed.

You are right, that sound like some problem with compression - got any hint what to do next/what to read?

It should also make un-compressed files. Try using those instead. When you put them in a zip, they get compressed for upload, and our servers should be serving them automatically compressed (without needing a .htaccess file).

Response to Unity3d WebGL Support 2016-03-09 09:11:37


It should also make un-compressed files. Try using those instead. When you put them in a zip, they get compressed for upload, and our servers should be serving them automatically compressed (without needing a .htaccess file).

thank you for your help.

For those who have this problem:
You can simply unzip your:
dogar.datagz
dogar.jsgz
dogar.memgz

into

dogar.data
dogar.js
dogar.mem

and it will work like a charm :)

Response to Unity3d WebGL Support 2016-03-09 10:21:26


At 3/9/16 09:11 AM, Railman85 wrote:
It should also make un-compressed files. Try using those instead. When you put them in a zip, they get compressed for upload, and our servers should be serving them automatically compressed (without needing a .htaccess file).
thank you for your help.

For those who have this problem:
You can simply unzip your:
dogar.datagz
dogar.jsgz
dogar.memgz

into

dogar.data
dogar.js
dogar.mem

and it will work like a charm :)

Awesome, glad you got it working!

Response to Unity3d WebGL Support 2016-04-06 09:44:20


Just tested a mouse-based game with Unity 5.3 in WebGL and everything looks to be working pretty good.