00:00
00:00
Newgrounds Background Image Theme

supahVEVO 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!

Newgrounds.io Help & Support

47,184 Views | 137 Replies
New Topic Respond to this Topic

Response to Newgrounds.io Help & Support 2017-12-29 11:51:19


At 12/28/17 07:30 AM, dynamitewhale wrote:
At 12/13/17 11:46 AM, PsychoGoldfish wrote:
The key part is the error you are getting back:
"error":{"code":0,"message":"Medal.unlock requires a valid user session."}

If the user isn't signed in, they can't unlock anything. See https://bitbucket.org/newgrounds/newgrounds.io-for-unity-c/#markdown-header-using-newgrounds-passport for information on how to sign a user in.
When I am testing the game in the preview mode, I am logged in.
How can I test the API in the preview stage?

---
Do I need to start a session manually for badges to work? http://www.newgrounds.io/help/components/#app-startsession
Or does the core take care of that?`(there is somce code there that looks like it initializes the session on Start())

If you are already logged in, App.checkSession can be used to pull your user info without starting a new session.

See http://www.newgrounds.io/help/passport/ for a break down of how all the session components are meant to work.

The Unity Library should handle all that if you are using it correctly though.

Are you trying to unlock a medal instantly just to see if it works? If so, you may be sending the API call before the user object has been loaded from the server. You shouldn't make any unlock calls until after your login stuff has called your onLoggedIn() method.

Response to Newgrounds.io Help & Support 2018-01-01 16:50:30


At 12/29/17 11:51 AM, PsychoGoldfish wrote:
At 12/28/17 07:30 AM, dynamitewhale wrote:
At 12/13/17 11:46 AM, PsychoGoldfish wrote:
The key part is the error you are getting back:
"error":{"code":0,"message":"Medal.unlock requires a valid user session."}

If the user isn't signed in, they can't unlock anything. See https://bitbucket.org/newgrounds/newgrounds.io-for-unity-c/#markdown-header-using-newgrounds-passport for information on how to sign a user in.
When I am testing the game in the preview mode, I am logged in.
How can I test the API in the preview stage?

---
Do I need to start a session manually for badges to work? http://www.newgrounds.io/help/components/#app-startsession
Or does the core take care of that?`(there is somce code there that looks like it initializes the session on Start())
If you are already logged in, App.checkSession can be used to pull your user info without starting a new session.

See http://www.newgrounds.io/help/passport/ for a break down of how all the session components are meant to work.

The Unity Library should handle all that if you are using it correctly though.

Are you trying to unlock a medal instantly just to see if it works? If so, you may be sending the API call before the user object has been loaded from the server. You shouldn't make any unlock calls until after your login stuff has called your onLoggedIn() method.

Hi PsychoGoldfish,

thank you for your support. You were totally right with your suspicion of me trying to call the API before the core was initilialized..
also I was trying to run logic in the same method as calling the API, and not in the callback - that's what caused most of my issues. After resolving that, it went much smoother.
I have a last question - it's not a blocker anymore, because I hacked my way around it, but I wanted to understand how the medal.unlocked property works.

If I check the medal.unlocked property in the callback, it is alwaysfalse.
If I get the list of medals, the medal has the "correct" value (either, true or false depending on whether the medal has been unlocked or not).

Is this intended?
I implemented an ingame medal-notification, and off course I only want it to show when unlocking the medal for the first time. But since the medal.unlocked value from the callback seemed broken I now do the following:
On startup get list of all medals
Make Dictionary of medals and their unlock status
Whenever I get a medal-unlock-callback, I check my dictionary of the medals whether it was unlocked or not, and show the notification.
Then I also update the status of the medal in my dictionary.

It works fine, but it feels quite hacky.


What's the status with in-game ads? It sounds like it's not part of NG.io but can I still use the old API? if so, could I get access to http://www.newgrounds.com/projects/games/826040/apitools for reference, or can I get my project's ads approved, if that helps me learn the tools? (this project will never get published)


DELETED: accidental post

Response to Newgrounds.io Help & Support 2018-03-13 08:35:28


Any guide on how to use this on Clickteam fusion 2.5, Game Maker 1.4 and RPG maker MV?

Response to Newgrounds.io Help & Support 2018-07-06 04:13:33


I'm having a little problem. When I test my game the score doesn't seem to go to the scoreboard. I didn't use much code. Just the stuff from the start...

- Create an Empty GameObject (Ctrl+Shift+N)
- Select the new GameObject and rename it to "Newgrounds.io Object" from the Inspector panel.
- While still on the Inspetor panel, click the 'Add Component' button.
- Select Scripts -> io.newgorunds -> Core
- Fill in the App_id and Aes_base64_key properties with the values found in the 'API Tools' section of your Newgrounds.com project.

and this code to send the highscore...

public void SubmitScore(int id, int value)
{
io.newgrounds.components.ScoreBoard.postScore submit_score = new io.newgrounds.components.ScoreBoard.postScore();
submit_score.id = id;
submit_score.value = value;
submit_score.callWith(ngio_core);
}

Is there something I'm missing? I checked and the game is connecting when I start the game. I'm also not getting any errors.

Response to Newgrounds.io Help & Support 2018-07-06 21:35:27


Now I'm getting this error
"Unable to cast object of type 'ResultModel' to type 'postScore'. "

Any ideas on how to fix it?

Response to Newgrounds.io Help & Support 2018-07-06 23:13:09


Just wanted to say, I figured it out. Apparently I had the wrong Aes_base64_key

Response to Newgrounds.io Help & Support 2018-09-09 11:19:53


I managed to put Newgrounds medals and topscores in my game 'Foreign Frugglers' with Game Maker Studio 1.4. (GM2 also works)
Here's the game: https://www.newgrounds.com/portal/view/716161
Here's the GMEZ: https://marketplace.yoyogames.com/assets/7326/newgrounds-api

Good Luck with the integration! Medals and Topscores are GREAT!

-UltimoGames

Newgrounds.io Help & Support


Blow off some STEAM!

BBS Signature

Response to Newgrounds.io Help & Support 2018-09-11 11:48:01


At 9/9/18 11:19 AM, UltimoGames wrote: I managed to put Newgrounds medals and topscores in my game 'Foreign Frugglers' with Game Maker Studio 1.4. (GM2 also works)
Here's the game: https://www.newgrounds.com/portal/view/716161
Here's the GMEZ: https://marketplace.yoyogames.com/assets/7326/newgrounds-api

Good Luck with the integration! Medals and Topscores are GREAT!

-UltimoGames

Nice work! I added a link on the newgrounds.io dowloads page.

Response to Newgrounds.io Help & Support 2018-09-11 12:54:12


Actually, Sabooo https://sabooo.newgrounds.com/ made the GMEZ script, I just implemented in the game. Credits were credits are due. Thanks & Good luck


Blow off some STEAM!

BBS Signature

Response to Newgrounds.io Help & Support 2018-09-11 14:32:50


At 9/11/18 12:54 PM, UltimoGames wrote: Actually, Sabooo https://sabooo.newgrounds.com/ made the GMEZ script, I just implemented in the game. Credits were credits are due. Thanks & Good luck

fixed, thanks for letting me know!

Response to Newgrounds.io Help & Support 2018-09-11 16:00:10


thanks for fixing it, I already told him about this. It is cool.


Blow off some STEAM!

BBS Signature

Response to Newgrounds.io Help & Support 2018-10-15 08:35:37


Hey all i'm trying to do send my highscore to the leaderboard... i have a script that has the highscore int variable (in C#) can you tell me the simple steps to achieve this? i have downloaded the newgrounds.io files which are shwon here http://prntscr.com/l6ags6 what do i have to do to send the high score to the leaderboards? ive created a scoreboard etc

Response to Newgrounds.io Help & Support 2018-11-16 18:21:12


a little help, im trying to implement the medals on my unity webgl game, i put the component and etc, on unity editor the tests didnt returned the medals name and vallue, so i tryed to upload to newgrounds to test, and i got this error when i play

exception thrown: TypeError: rules[r].selectorText is undefined,_newgroundsioAddPluginScripts@blob:null/a61adddb-8695-4a4f-9d2d-c8b9b21b81d0:2:187558
D3j@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:6:1
C3j@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:6:1
Kxj@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:6:1
yTl@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:20:1
invoke_iiii@blob:null/a61adddb-8695-4a4f-9d2d-c8b9b21b81d0:2:367773
cbl@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:20:1
lel@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:20:1
z5@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:7:1
x5@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:7:1
h$a@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:13:1
g$a@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:13:1
XNb@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:12:1
_vb@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:10:1
lVa@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:13:1
Vha@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:11:1
Iha@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:11:1
cTl@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:20:1
browserIterationFunc@blob:null/a61adddb-8695-4a4f-9d2d-c8b9b21b81d0:2:47932
runIter@blob:null/a61adddb-8695-4a4f-9d2d-c8b9b21b81d0:2:51024
Browser_mainLoop_runner@blob:null/a61adddb-8695-4a4f-9d2d-c8b9b21b81d0:2:49469
UnityLoader.js:1:7402
Invoking error handler due to
TypeError: rules[r].selectorText is undefined UnityLoader.js:1:13902
TypeError: rules[r].selectorText is undefined

anyone had this error before?

Response to Newgrounds.io Help & Support 2018-12-08 17:23:22


At 11/16/18 06:21 PM, GGMagenta wrote: a little help, im trying to implement the medals on my unity webgl game, i put the component and etc, on unity editor the tests didnt returned the medals name and vallue, so i tryed to upload to newgrounds to test, and i got this error when i play

exception thrown: TypeError: rules[r].selectorText is undefined,_newgroundsioAddPluginScripts@blob:null/a61adddb-8695-4a4f-9d2d-c8b9b21b81d0:2:187558
D3j@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:6:1
C3j@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:6:1
Kxj@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:6:1
yTl@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:20:1
invoke_iiii@blob:null/a61adddb-8695-4a4f-9d2d-c8b9b21b81d0:2:367773
cbl@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:20:1
lel@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:20:1
z5@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:7:1
x5@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:7:1
h$a@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:13:1
g$a@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:13:1
XNb@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:12:1
_vb@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:10:1
lVa@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:13:1
Vha@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:11:1
Iha@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:11:1
cTl@blob:null/9f7ec30c-4a46-422c-85b7-cdf9b6fcc2b1:20:1
browserIterationFunc@blob:null/a61adddb-8695-4a4f-9d2d-c8b9b21b81d0:2:47932
runIter@blob:null/a61adddb-8695-4a4f-9d2d-c8b9b21b81d0:2:51024
Browser_mainLoop_runner@blob:null/a61adddb-8695-4a4f-9d2d-c8b9b21b81d0:2:49469
UnityLoader.js:1:7402
Invoking error handler due to
TypeError: rules[r].selectorText is undefined UnityLoader.js:1:13902
TypeError: rules[r].selectorText is undefined

anyone had this error before?

I'm having this same issue... I think I've narrowed it down to be something to do with what Unity WebGL template you use -- I've noticed if I use the default Unity WebGL template(with the fullscreen button) it doesn't produce this error, but when I do that it has other odd issues(it actually makes most of my shaders not render, my textures show up as pink boxes and whatnot... seems to me like it's corrupting the game files(I got a memory access out of range error at one point too...)but that's just my guess). When I play the game locally it all works fine.

If I switch to my own Unity WebGL template it doesn't have the pink textures but it crashes on launch with the rules[r].selectorText error above... The odd thing is I had it working at one point and then it started doing this... Not sure what I did differently to get it working though.

Something I've just noticed is that if I delete the uploaded file before uploading another build it seems to behave differently(as in, the pink textures aren't there sometimes, etc)... So it could be a cache issue? I've tried incognito mode with Chrome and it's not working though... very strange.

Response to Newgrounds.io Help & Support 2018-12-09 10:18:53


Sorry for the double post (I couldn't find a way to edit my previous post...) but I was able to work-around this by adding a null check for rules[r] and rules[r].selectorText around line ~213 in the newgroundsIOPlugin.jslib file. Furthermore, I think the issue I was experiencing with the textures going pink was a separate problem probably related to my browser cache.

Response to Newgrounds.io Help & Support 2019-06-25 17:40:25


At 8/1/16 01:58 PM, PsychoGoldfish wrote: If you are interested in in-game ads, we will not be adding those to this API. The old Flash API often had issues with ad-blockers because they would occasionally block access to the entire API server, and we do not want a repeat of that with Newgrounds.io.

At some point, we will be looking at creating a standalone API for implementing ads in games, so keep your eyes open for that.


I would like to know whether there is any implementation of the standalone API yet, if not is it possible to have a look at the .flas to see how I can implement it?

Response to Newgrounds.io Help & Support 2019-07-10 05:28:37


Hi PsychoGoldfish,

I am trying to add medals and scoreboard features to my wick game. I tried loading up the newgrounds.io's wick file in alpha.wickeditor.com site. Its not loading up.

I tried to load it using the legacy editor. But just found it was closed down.

Do look into it, when you are free, cause the newground's wick file doesn't work anymore.

Response to Newgrounds.io Help & Support 2019-07-23 09:27:09


I am also having issues with the Wick file not being able to be imported, has a minor updated with the Wick Editor broken something?

Response to Newgrounds.io Help & Support 2019-07-23 10:01:00


At 7/23/19 09:27 AM, Little-Rena wrote: I am also having issues with the Wick file not being able to be imported, has a minor updated with the Wick Editor broken something?


Yeah, Wick is still undergoing changes, so pretty much any work I had done with it is already obsolete, and since the jam has ended I haven't really taken any time to get the API working in it again. @luxapodular had tried porting my example, but I'm not sure how well it works for every feature. You can grab his port at https://cdn.discordapp.com/attachments/500735280815538187/586637769980379176/Newgrounds.io_WickEditor1.0.wick


Otherwise, if you want to try implementing it yourself, the pure javascript library is available at https://bitbucket.org/newgrounds/newgrounds.io-for-javascript-html5/src/default/


I basically pasted the minified js file into the first frame of a wick project, and created a global instance of Newgrounds.io.core I could use throughout my game, then added a layer that could show medals as they were unlocked and did a little animation. Scoreboards were a bit more complicated, but all the code to make them work is there.

Response to Newgrounds.io Help & Support 2019-07-23 10:02:52


At 7/23/19 10:01 AM, PsychoGoldfish wrote:
At 7/23/19 09:27 AM, Little-Rena wrote: I am also having issues with the Wick file not being able to be imported, has a minor updated with the Wick Editor broken something?
Yeah, Wick is still undergoing changes, so pretty much any work I had done with it is already obsolete, and since the jam has ended I haven't really taken any time to get the API working in it again. @luxapodular had tried porting my example, but I'm not sure how well it works for every feature. You can grab his port at https://cdn.discordapp.com/attachments/500735280815538187/586637769980379176/Newgrounds.io_WickEditor1.0.wick

Otherwise, if you want to try implementing it yourself, the pure javascript library is available at https://bitbucket.org/newgrounds/newgrounds.io-for-javascript-html5/src/default/

I basically pasted the minified js file into the first frame of a wick project, and created a global instance of Newgrounds.io.core I could use throughout my game, then added a layer that could show medals as they were unlocked and did a little animation. Scoreboards were a bit more complicated, but all the code to make them work is there.


I figured it was the case that Wick keeps changing, I'll have a look at the port, thanks for your help!

Response to Newgrounds.io Help & Support 2019-09-21 06:40:43


At 8/1/16 01:58 PM, PsychoGoldfish wrote: Newgrounds.io is the successor to the old Newgrounds Flash API. We've completely re-built the server API to remove all dependencies on custom ActionScript classes.

Now, ANY platform should be able to use the API. The only requirements are the ability to encode and decode JSON objects, and post over HTTP.

Newgrounds.io is launching it's public beta today. We already have some libraries available for platforms that target HTML5, and complete documents on how you can build your own libraries from any other platform.

Newgrounds.io is going in to public beta today, so if you start using it, and need help or support, post in this thread and we'll get back to you as soon as we can.

If you plan on implementing Newgrounds.io into a platform we haven't covered yet, you should also check out the Newgrounds.io Developers Group. I'll be posting any major updates to the server API in there, so joining the group will keep you in the loop.

Now, before anyone DOES post for help in here, make sure you have already checked the Getting Started and Help pages on www.newgrounds.io, or the help documents for any Newgrounds.io libraries you are using. There's a lot of useful information already out there.

If you are interested in in-game ads, we will not be adding those to this API. The old Flash API often had issues with ad-blockers because they would occasionally block access to the entire API server, and we do not want a repeat of that with Newgrounds.io.

At some point, we will be looking at creating a standalone API for implementing ads in games, so keep your eyes open for that.

Also, we haven't implemented any NEW features at the time of this post, we were primarily concerned with updating the network interface and encryption options so the whole thing is a lot more platform agnostic.

The 'save data' feature is still being rebuilt (the old version was VERY Flash-oriented), and is not currently available. When it becomes available I'll post about it in here and in the developer group.

You can also follow the project on Twitter, I'll be posting news and changes there as well.


Can someone develop something similar to this : https://cutt.ly/LwXFl4B


I am trying to postScore using the JavaScript/HTML API but it doesn't do anything. I get all the scoreBoards and it went correctly when I try to postScore nothing happens with no errors but nothing is being posted. and the callback is returning that weird error. "error: {code: 0, message: "Unexpected Server Response"}"

Response to Newgrounds.io Help & Support 2019-11-26 12:56:22


At 11/26/19 12:22 PM, amidos2006 wrote: I am trying to postScore using the JavaScript/HTML API but it doesn't do anything. I get all the scoreBoards and it went correctly when I try to postScore nothing happens with no errors but nothing is being posted. and the callback is returning that weird error. "error: {code: 0, message: "Unexpected Server Response"}"


9 times out of 10, if you can load scores but not post them, it's a problem with your encryption key. Make sure you have that configured properly and the key was copy/pasted properly. Also make sure you are using the newgrounds.io API on your api tools page. It still defaults to the old Flash API there.

Response to Newgrounds.io Help & Support 2019-11-26 13:29:49


Thanks a lot :) that actually worked, I just changed to the new api and used the new token and it worked :) Stupid me :)


Thanks again :)


At 11/26/19 12:56 PM, PsychoGoldfish wrote:
At 11/26/19 12:22 PM, amidos2006 wrote: I am trying to postScore using the JavaScript/HTML API but it doesn't do anything. I get all the scoreBoards and it went correctly when I try to postScore nothing happens with no errors but nothing is being posted. and the callback is returning that weird error. "error: {code: 0, message: "Unexpected Server Response"}"
9 times out of 10, if you can load scores but not post them, it's a problem with your encryption key. Make sure you have that configured properly and the key was copy/pasted properly. Also make sure you are using the newgrounds.io API on your api tools page. It still defaults to the old Flash API there.


Response to Newgrounds.io Help & Support 2020-04-20 16:11:11


I am just wondering if the scoreboard is visible in preview mode? I am using the newgrounds.io and I've done some console.log and I see my scoreboards and I also see in "ScoreBoard.getScores" that there is scores submitted. But I don't see any Scoreboard in preview mode so not sure if it gonna work when I publish it.

Response to Newgrounds.io Help & Support 2020-04-20 19:25:50


At 4/20/20 04:11 PM, Terzom wrote: I am just wondering if the scoreboard is visible in preview mode? I am using the newgrounds.io and I've done some console.log and I see my scoreboards and I also see in "ScoreBoard.getScores" that there is scores submitted. But I don't see any Scoreboard in preview mode so not sure if it gonna work when I publish it.


The project previews currently have no newgrounds.io views. What you see in getScores is accurate.


Hey, I'm trying to get wrap my head around NG.io for my unity projects. I've got it set up and I'm able to unlock medals and submit scores! I want to get the most I can out of this API. That said, I have a quick question:

How do you check if a medal has already been unlocked? I imagine it has to do with Medal.getList, but I'm not sure how to access the data (I'm shockingly unfamiliar with how lists work...)


Banner by @MigMoog

BBS Signature

At 4/24/20 05:24 PM, mayorDump wrote: How do you check if a medal has already been unlocked? I imagine it has to do with Medal.getList, but I'm not sure how to access the data (I'm shockingly unfamiliar with how lists work...)


You can do something like this (assuming ngioCore is an initialised core component):


// Get the medal list
var medalList = new components.Medal.getList();
medalList.callWith(ngioCore, OnGetMedalList);

Which calls the OnGetMedalList method when it's done.

using System.Linq;

[SerializeField] int id = 0; // medal ID of the medal you want to unlock

void OnGetMedalList(getList getList)
{
    List<medal> medals = getList.medals.Cast<medal>().ToList(); // cast the result into a list of medals
    medal current = medals.FirstOrDefault(m => m.id == id); // first medal with our ID
    if (current == null)
    {
        //! Wrong ID or bad cast
        if (medals.Count >= 1 && id != 0)
        {
            // Good cast, bad ID
            Debug.LogWarning($"Trying to unlock a non-existent medal with ID: <b>{id}</b>.\nCheck your <i>Project Settings</i> on Newgrounds; and make sure you created a matching Medal asset in Unity.");
        }
        return;
    }

    if (!current.unlocked)
    {
        var medalUnlock = new components.Medal.unlock {id = current.id};                      
        try
        {
            medalUnlock.callWith(ngioCore, OnMedalUnlocked); 
        } catch (InvalidCastException)
        {
            //! Failed to unlock (see enable network data log)        
            Debug.LogWarning("Failed to unlock the medal. Try enabling the network data option of 'Core' prefab to see more details.");
        }
    }
}


If you just want the list, the first line is enough. You can then pick a medal from the list (e.g. the one with ID we want here) and check if it's unlocked "yourMedal.unlocked". Make sure it's not null or wrong (if you supply a bad ID, for example). If you're getting InvalidCastException (which I catch in the code above), that seems to mean it couldn't unlock the medal / get the list; presumably because the core component wasn't initialised properly (you can check the exact reason by enabling network data output: ngioCore.output_network_data = true).


I don't think it's a big issue if you unlock a medal twice (it won't fail or cause an error), but if you're showing a medal popup, for example, you don't want to show it twice to the same user, at least not during the same game session.


Also, the above code doesn't check for people who aren't logged in / unregistered users; and for those the unlocked property will always be false (I think), so you might want to keep a list of medals unlocked during the current game session somewhere to avoid spamming medal popups – or just don't show popups to people who aren't logged in.