GKPlayer

Inherits: RefCounted < Object

Inherited By: GKLocalPlayer, GKSavedGame

Represents any Game Center player (local or remote).

Description

GKPlayer is the shared base type for friends, opponents, and the local user. Use it to access Apple-provided identifiers plus helper methods such as load_photo(), as referenced in the “Players” section of GameCenterGuide.md. Apple’s reference lives at Apple’s GKPlayer documentation.

Loading a player photo (guide sample):

# Put the downloaded image inside a TextureRect named $texture_rect.
local_player.load_photo(true, func(image: Image, error: Variant) -> void:
    if error == null:
        $texture_rect.texture = ImageTexture.create_from_image(image)
    else:
        print("Could not load photo %s" % error)
)

Properties

String

alias

"Unknown"

String

display_name

""

String

game_player_id

"35F4D53AA03317E8DCEFDBDB14943B03FE9C908214139E44661F131895E6E51C"

bool

is_invitable

false

String

team_player_id

"EFE0530BC629B6FEB2BB992C9F1DC62649393BEAFC38B5A41903CCD90E33068F"

Methods

void

load_photo(small: bool, callback: Callable)

bool

scopedIDsArePersistent()


Property Descriptions

String alias = "Unknown" 🔗

Player-specified nickname.


String display_name = "" 🔗

Localized display name suited for UI.


String game_player_id = "35F4D53AA03317E8DCEFDBDB14943B03FE9C908214139E44661F131895E6E51C" 🔗

Stable, per-game identifier used by Apple to uniquely address the player.


bool is_invitable = false 🔗

  • bool get_is_invitable()

True if the player allows Game Center invitations.


String team_player_id = "EFE0530BC629B6FEB2BB992C9F1DC62649393BEAFC38B5A41903CCD90E33068F" 🔗

Team-scoped identifier shared with other games from the same developer account.


Method Descriptions

void load_photo(small: bool, callback: Callable) 🔗

Downloads the player’s avatar. Pass true for a small image or false for the normal size. The callback receives (Image image, Variant error) and exactly one argument is null, mirroring the Swift inline documentation.


bool scopedIDsArePersistent() 🔗

Returns the result of Apple’s scopedIDsArePersistent() method, letting you detect whether scoped identifiers stay stable for the current device/account combination.