Missing docs for event.data on unlockAchievement (Game Center)

I’ve never implemented achievements for Apple Game Center before, and now that I’m finally doing it, I just ran into something confusing in the docs.

On the official plugin page ( https://docs.coronalabs.com/plugin/gameNetwork-apple when using:

gameNetwork.request( "unlockAchievement", params )

it says the callback event includes event.type == "unlockAchievement" and also event.data with info about the achievement.

The thing is, there’s no info anywhere about what fields are actually inside event.data for this case. For example, does it include identifier, percentComplete, etc.?
For other requests like loadAchievements, everything is clearly listed, but for unlockAchievement it’s kind of a mystery.

I’m trying to confirm what exactly comes back in event.data when an achievement is successfully unlocked (and if it behaves differently when the achievement was already unlocked before).

Would be awesome if the docs could add a small table (like the one for loadAchievements) describing what event.data actually contains, and what you can expect when event.isError is true/false.

Anyone from the team or community knows the exact structure?

You should be able to see all the data from the event table with JSON

local json= require "json"
.
.
.
json.encode(event)
OR
json.encode(event.data)

If you print this output to console, it will probably show in your iOS test device’s logs or you can use something like a toast plugin or something to just output the data as text rendered to your app for debugging.

1 Like

Thanks, @famousdoggstudios I knew I could do that, but I didn’t really want to get to that point :wink:

1 Like