In this document is listed the plugin signals and methods available for use inside Godot with GDScript. The source code is available here.
After you install the plugin in android/plugins
and enable it on your Export preset, you should be able to access its functionalities through:
Engine.get_singleton("GodotGooglePlayGameServices")
⚠️ Keep in mind that a wrapper with full autocompletion is already available at this repository, so prefer using it instead of interfacing with the native plugin singleton directly.
These signals belong to the native plugin singleton and can be used by connecting them to a method.
func _ready() -> void:
var plugin: JNISingleton = Engine.get_singleton("GodotGooglePlayGameServices")
plugin.connect("leaderboardsAllLoaded", self, "_on_allLeaderboardsLoaded")
plugin.loadAllLeaderboards(true)
func _on_allLeaderboardsLoaded(leaderboards: String) -> void:
var parsed_leaderboards: Dictionary = JSON.parse(leaderboards).result
prints(parsed_leaderboards)
This signal is emitted when calling the achievementsLoad
method.
Returns A JSON string with a list of Achievement.
This signal is emitted when calling the achievementsReveal
method.
Returns true
if the achievement is revealed and false
otherwise.
Also returns the id of the achievement.
This signal is emitted when calling the achievementsIncrement
, achievementsSetSteps
or achievementsUnlock
methods.
Returns true
if the achievement is unlocked or false
otherwise.
Also returns the id of the achievement.
This signal is emitted when calling the eventsLoad
method.
Returns A JSON string with the list of Event.
This signal is emitted when calling the eventsLoadByIds
method.
Returns A JSON string with the list of Event.
This signal is emitted when calling the leaderboardsSubmitScore
method.
Returns true
if the score is submitted. false
otherwise. Also returns the id of the leaderboard.
This signal is emitted when calling the leaderboardsLoadPlayerScore
method.
Return The leaderboard id and a JSON string with a LeaderboardScore.
This signal is emitted when calling the leaderboardsLoadAll
method.
Returns A JSON string with a list of Leaderboard.
This signal is emitted when calling the leaderboardsLoad
method.
Returns A JSON string with a Leaderboard.
This signal is emitted when calling the playersLoadCurrent
method.
Returns A JSON string with a Player.
This signal is emitted when calling the playersLoadFriends
method.
Returns A JSON with a list of Player.
This signal is emitted when selecting a player in the search window that is being displayed after calling the [playersSearch] method. Returns A JSON string with a Player.
This signal is emitted when calling the signInIsAuthenticated
and signInShowPopup
methods.
Returns true
if the user is authenticated or false
otherwise.
This signal is emitted when calling the signInRequestServerSideAccess
method.
Returns an OAuth 2.0 authorization token as a string.
This signal is emitted when calling the snapshotsSaveGame
method.
Returns a boolean indicating if the game was saved or not, and the name and description of the save file.
This signal is emitted when calling the snapshotsLoadGame
method or after selecting a saved game in the window opened by the snapshotsShowSavedGames
method.
Returns A JSON string representing a Snapshot.
This signal is emitted when saving or loading a game, whenever a conflict occurs. Returns A JSON string representing a SnapshotConflict.
Increments an achievement by the given number of steps.
The achievement must be an incremental achievement.
Once an achievement reaches at least the maximum number of steps, it will be unlocked automatically.
Any further increments will be ignored.
Emits achievementsUnlocked
.
Loads the achievement data for the currently signed-in player.
Emits achievementsLoaded
.
Reveals a hidden achievement to the currently signed-in player.
If the achievement has already been unlocked, this will have no effect.
Emits achievementRevealed
if immediate
is true
.
Sets an achievement to have at least the given number of steps completed.
The achievement must be an incremental achievement.
Once an achievement reaches at least the maximum number of steps, it will be unlocked automatically.
Emits achievementsUnlocked
if immediate
is true
.
Shows a native popup to browse game achievements of the currently signed-in player.
Unlocks an achievement for the currently signed in player.
If the achievement is hidden this will reveal it to the player.
Emits achievementsUnlocked
if immediate
is true
.
Increments an event specified by eventId by the given number of steps. This is the fire-and-forget form of the API (no signals are emitted).
Loads the event data for the currently signed-in player. Emits eventsLoaded
.
Loads the event data for the currently signed-in player for the specified ids. Emits eventsLoadedByIds
.
Shows a native popup to browse all leaderboards.
Shows a native popup to browse the specified leaderboard.
Shows a native popup to browse the specified leaderboard for the specified time span.
Shows a native popup to browse the specified leaderboard for the specified time span and collection.
Submits a score to the specified leaderboard. Emits leaderboardsScoreSubmitted
.
Loads the player's score for the specified leaderboard. Emits leaderboardsScoreLoaded
.
Loads the leaderboard data for the currently signed-in player. Emits leaderboardsAllLoaded
.
Loads the leaderboard data for the currently signed-in player. Emits leaderboardsLoaded
Shows a native popup to compare two players.
playersCompareProfileWithAlternativeNameHints(otherPlayerId: String, otherPlayerInGameName: String, currentPlayerInGameName: String)
Shows a native popup to compare two players with alternative name hints.
Loads the player data for the currently signed-in player. Emits playersCurrentLoaded
.
Loads the friends data for the currently signed-in player. Emits playersFriendsLoaded
.
Shows a native popup to search for players. Emits playersSearched
.
Checks if the user is signed in. Emits signInUserAuthenticated
.
Show a native popup to sign in the user. Emits signInUserAuthenticated
.
Requests server-side access for the specified server client ID. Emits signInRequestedServerSideAccess
.
Loads a game from the specified file. Emits snapshotsGameLoaded
or snapshotsConflictEmitted
.
snapshotsSaveGame(fileName: String, description: String, saveData: PoolByteArray, playedTimeMillis: int, progressValue: int)
Saves a game to the specified file. Emits snapshotsGameSaved
or snapshotsConflictEmitted
.
Shows a native popup to browse saved games. Emits snapshotsGameLoaded
.