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¶
|
||
|
||
|
||
|
||
|
Methods¶
void |
load_photo(small: bool, callback: Callable) |
Property Descriptions¶
String get_alias()
Player-specified nickname.
String get_display_name()
Localized display name suited for UI.
String game_player_id = "35F4D53AA03317E8DCEFDBDB14943B03FE9C908214139E44661F131895E6E51C" 🔗
String get_game_player_id()
Stable, per-game identifier used by Apple to uniquely address the player.
bool get_is_invitable()
True if the player allows Game Center invitations.
String team_player_id = "EFE0530BC629B6FEB2BB992C9F1DC62649393BEAFC38B5A41903CCD90E33068F" 🔗
String get_team_player_id()
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.