GodotAndroidPlugin

class GodotAndroidPlugin(godot: Godot) : GodotPlugin

This is the main Godot Plugin class exposing the interfaces to use with Godot. In this class you will find all the methods that can be called in your game via GDScript.

Constructors

Link copied to clipboard
constructor(godot: Godot)

Functions

Link copied to clipboard
fun compareProfile(otherPlayerId: String)

Displays a screen where the user can see a comparison of their own profile against another player's profile.

Link copied to clipboard
fun compareProfileWithAlternativeNameHints(otherPlayerId: String, otherPlayerInGameName: String, currentPlayerInGameName: String)

Displays a screen where the user can see a comparison of their own profile against another player's profile.

Link copied to clipboard
fun deleteSnapshot(snapshotId: String)

Deletes the given snapshot. This will delete the data of the snapshot locally and on the server.

Link copied to clipboard
fun incrementAchievement(achievementId: String, amount: Int)

Use this method to increment a given achievement in the given amount. For normal achievements, use the unlockAchievement method instead.

Link copied to clipboard
fun incrementEvent(eventId: String, incrementAmount: Int)

Increments an event specified by eventId by the given number of steps.

Link copied to clipboard

This method initializes the Play Games SDK. It should be called right after checking that the plugin is loaded into Godot, for example:

Link copied to clipboard

Use this method to check if the user is already authenticated. If the user is authenticated, a popup will be shown on screen.

Link copied to clipboard
fun loadAchievements(forceReload: Boolean)

Call this method and subscribe to the emitted signal to receive the list of the game achievements in JSON format. The JSON received from the com.jacobibanez.plugin.android.godotplaygameservices.signals.AchievementsSignals.achievementsLoaded signal contains a representation of the com.google.android.gms.games.achievement.Achievement class.

Link copied to clipboard
fun loadAllLeaderboards(forceReload: Boolean)

Call this method and subscribe to the emitted signal to receive all leaderboards for the game in JSON format. The JSON received from the com.jacobibanez.plugin.android.godotplaygameservices.signals.LeaderboardSignals.allLeaderboardsLoaded signal, contains a list of elements representing the com.google.android.gms.games.leaderboard.Leaderboard class.

Link copied to clipboard
fun loadCurrentPlayer(forceReload: Boolean)

Call this method and subscribe to the emitted signal to receive the currently signed in player in JSON format.The JSON received from the com.jacobibanez.plugin.android.godotplaygameservices.signals.PlayerSignals.currentPlayerLoaded signal, contains a representation of the com.google.android.gms.games.Player class.

Link copied to clipboard
fun loadEvents(forceReload: Boolean)

Loads a list of events for the currently signed-in player. This method emits the com.jacobibanez.plugin.android.godotplaygameservices.signals.EventsSignals.eventsLoaded signal.

Link copied to clipboard
fun loadEventsByIds(forceReload: Boolean, eventIds: Array<String>)

Loads a specific list of events for the currently signed-in player. This method emits the com.jacobibanez.plugin.android.godotplaygameservices.signals.EventsSignals.eventsLoadedByIds signal.

Link copied to clipboard
fun loadFriends(pageSize: Int, forceReload: Boolean, askForPermission: Boolean)

Call this method and subscribe to the emitted signal to receive the list of friends for the currently signed in player in JSON format. The JSON received from the com.jacobibanez.plugin.android.godotplaygameservices.signals.PlayerSignals.friendsLoaded signal, contains a list of elements representing the com.google.android.gms.games.Player class.

Link copied to clipboard
fun loadGame(fileName: String, createIfNotFound: Boolean = false)

Loads game data from the Google Cloud. This method emits the com.jacobibanez.plugin.android.godotplaygameservices.signals.SnapshotSignals.gameLoaded signal.

Link copied to clipboard
fun loadLeaderboard(leaderboardId: String, forceReload: Boolean)

Call this method and subscribe to the emitted signal to receive the specific leaderboard in JSON format. The JSON received from the com.jacobibanez.plugin.android.godotplaygameservices.signals.LeaderboardSignals.leaderboardLoaded signal, contains a representation of the com.google.android.gms.games.leaderboard.Leaderboard class.

Link copied to clipboard
fun loadPlayerCenteredScores(leaderboardId: String, timeSpan: Int, collection: Int, maxResults: Int, forceReload: Boolean)

Call this method and subscribe to the emitted signal to receive the selected leaderboard and an array of scores for that leaderboard, centered in the currently signed in player. The JSON received from the com.jacobibanez.plugin.android.godotplaygameservices.signals.LeaderboardSignals.playerCenteredScoresLoaded signal, contains a representation of the com.google.android.gms.games.LeaderboardsClient.LeaderboardScores class.

Link copied to clipboard
fun loadPlayerScore(leaderboardId: String, timeSpan: Int, collection: Int)

Call this method and subscribe to the emitted signal to receive the score of the currently signed in player for the given leaderboard, time span, and collection in JSON format. The JSON received from the com.jacobibanez.plugin.android.godotplaygameservices.signals.LeaderboardSignals.scoreLoaded signal contains a representation of the com.google.android.gms.games.leaderboard.LeaderboardScore class.

Link copied to clipboard
Link copied to clipboard
fun loadTopScores(leaderboardId: String, timeSpan: Int, collection: Int, maxResults: Int, forceReload: Boolean)

Call this method and subscribe to the emitted signal to receive the selected leaderboard and an array of the top scores for that leaderboard. The JSON received from the com.jacobibanez.plugin.android.godotplaygameservices.signals.LeaderboardSignals.playerCenteredScoresLoaded signal, contains a representation of the com.google.android.gms.games.LeaderboardsClient.LeaderboardScores class.

Link copied to clipboard
fun requestServerSideAccess(serverClientId: String, forceRefreshToken: Boolean)

Requests server-side access to Play Games Services for the currently signed-in player.

Link copied to clipboard
fun revealAchievement(achievementId: String)

Use this method to reveal a hidden achievement to the current signed player. If the achievement is already unlocked, this method will have no effect.

Link copied to clipboard
fun saveGame(fileName: String, description: String, saveData: ByteArray, playedTimeMillis: Long, progressValue: Long)

Saves game data to the Google Cloud. The com.jacobibanez.plugin.android.godotplaygameservices.signals.SnapshotSignals.gameSaved signal will be emitted after saving the game.

Link copied to clipboard

Displays a screen where the user can search for players. If the user selects a player, then the com.jacobibanez.plugin.android.godotplaygameservices.signals.PlayerSignals.playerSearched signal will be emitted, returning the selected player.

Link copied to clipboard

Use this method to open a new window with the achievements of the game, and the progress of the player to unlock those achievements.

Link copied to clipboard

Shows a new screen with all the leaderboards for the game.

Link copied to clipboard
fun showLeaderboard(leaderboardId: String)

Shows a new screen for a specific leaderboard.

Link copied to clipboard
fun showLeaderboardForTimeSpan(leaderboardId: String, timeSpan: Int)

Shows a specific leaderboard for a given span of time.

Link copied to clipboard
fun showLeaderboardForTimeSpanAndCollection(leaderboardId: String, timeSpan: Int, collection: Int)

Shows a specific leaderboard for a given span of time and a specific type of collection.

Link copied to clipboard
fun showSavedGames(title: String, allowAddButton: Boolean, allowDelete: Boolean, maxSnapshots: Int)

Opens a new window to display the saved games for the current player. If you select one of the saved games, the com.jacobibanez.plugin.android.godotplaygameservices.signals.SnapshotSignals.gameLoaded signal will be emitted.

Link copied to clipboard
fun signIn()

Use this method to provide a manual way to the user for signing in.

Link copied to clipboard
fun submitScore(leaderboardId: String, score: Int)

Submits the score to the leaderboard for the currently signed-in player. The score is ignored if it is worse (as defined by the leaderboard configuration) than a previously submitted score for the same player.

Link copied to clipboard
fun unlockAchievement(achievementId: String)

Immediately unlocks the given achievement for the signed in player. If the achievement is secret, it will be revealed to the player.