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 |
|
|
String |
|
|
String |
|
|
String |
|
|
bool |
|
|
String |
|
Methods¶
anonymous_guest_player(identifier: String) static |
|
void |
load_photo(small: bool, callback: Callable) |
bool |
Property Descriptions¶
String alias = "Unknown" 🔗
String get_alias()
Player-specified nickname.
String display_name = "" 🔗
String get_display_name()
Localized display name suited for UI.
String game_player_id = "0385A40571857BF79B1BBCA9B3137291C9264648334D1322FC39A42AE34279C5" 🔗
String get_game_player_id()
Stable, per-game identifier used by Apple to uniquely address the player.
String guest_identifier = "" 🔗
String get_guest_identifier()
Guest identifier for anonymous players, or an empty string for signed-in Game Center accounts.
bool is_invitable = false 🔗
bool get_is_invitable()
True if the player allows Game Center invitations.
String team_player_id = "6CCAA3067C8514F3397B735F4B37EADA731E576D0A1643B1ADDE246FB407DB8F" 🔗
String get_team_player_id()
Team-scoped identifier shared with other games from the same developer account.
Method Descriptions¶
GKPlayer anonymous_guest_player(identifier: String) static 🔗
Creates an anonymous guest player object for identifier using Apple’s guest-player API.
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.