00:00
00:00
Newgrounds Background Image Theme
Upgrade Your Account!

HO HO HOPE you become a Newgrounds Supporter this year!

We're working hard to give you the best site possible, but we have bills to pay and community support is vital to keep things going and growing. Thank you for considering!

Become a Supporter so NG can see another Christmas!

Unity3d WebGL Support

66,406 Views | 123 Replies
New Topic Respond to this Topic

Response to Unity3d WebGL Support 2021-11-15 05:28:13 (edited 2021-11-15 05:28:51)


At 11/14/21 11:19 AM, Dsiak wrote:The upload score is working fine but the in game score display is broken, can someone review my code and see what could possible be wrong? Thanks in advance.


Oh yeah, I remember this.


It says the default limit is 10…

iu_472875_4428769.png


…but what it actually sends when you don't set it yourself is zero.

iu_472876_4428769.png


So you're actually getting the best “0” scoreboard entries.


Set the limit to something reasonable, and it should be okay.

public void LoadScore(string period)
{
    var getScores = new io.newgrounds.components.ScoreBoard.getScores();
    getScores.id = thenumber;
    getScores.period = period;
    getScores.social = false;
    getScores.limit = 25;
    getScores.callWith(ngioCore, OnScoresLoaded);
}


Also, you probably want to display the username rather than the "object" itself, so you need to get the name:

text += $" – {score.user.name} {score.value}";


Otherwise, you end up with this:

iu_472877_4428769.png

Response to Unity3d WebGL Support 2021-11-15 15:34:44


At 11/15/21 05:28 AM, RaIix wrote:
At 11/14/21 11:19 AM, Dsiak wrote:The upload score is working fine but the in game score display is broken, can someone review my code and see what could possible be wrong? Thanks in advance.

Oh yeah, I remember this.

It says the default limit is 10…

…but what it actually sends when you don't set it yourself is zero.

So you're actually getting the best “0” scoreboard entries.

Set the limit to something reasonable, and it should be okay.

Also, you probably want to display the username rather than the "object" itself, so you need to get the name:

Otherwise, you end up with this:


Thank you very much, now I can grab the score out of the scoreboard, based and epic you rock. Kind of silly having the limit be zero by default but regardless problem solved. You rock

Response to Unity3d WebGL Support 2022-07-30 15:30:11


What is the proper resolution size for WebGL? I can't seem to fit my whole game on the screen, the lowest Ive tried is 960x640

Response to Unity3d WebGL Support 2022-07-31 03:34:39


I don't think there's anything like a “proper” resolution. I think 848x480 is fairly commonly used, but really… use what fits your game, or rather exactly what is your game set up as in the Resolution and Presentation section of the Player Settings in Unity. You also need to add +32 vertically to that for the bottom bar in Newgrounds Project Settings if you use the "Default" WebGL template or a part of the game window will be cut off.


But if the game feels small no matter what, you could add a fullscreen switch or make it go fullscreen automatically in an onPointerDown event when you first click on it.