GKGameActivity

Inherits: RefCounted < Object

Represents an active Game Activity session.

Description

Wraps GKGameActivity, including lifecycle control, matching helpers, and score/achievement progress APIs.

Properties

Array

achievements

[]

GKGameActivityDefinition

activity_definition

null

float

creation_date

0.0

float

duration

0.0

float

end_date

0.0

String

identifier

""

float

last_resume_date

0.0

Array

leaderboard_scores

[]

String

party_code

""

String

party_url

""

Dictionary

properties

{}

float

start_date

0.0

int

state

0

Methods

void

check_pending_game_activity_existence(callback: Callable) static

GKGameActivity

create_with_definition(definition: GKGameActivityDefinition) static

void

end()

void

find_match(callback: Callable)

void

find_players_for_hosted_match(callback: Callable)

float

get_progress_on_achievement(achievement: GKAchievement)

GKLeaderboardScore

get_score_on_leaderboard(leaderboard: GKLeaderboard)

bool

is_valid_party_code(partyCode: String) static

GKMatchRequest

make_match_request()

void

pause()

void

remove_achievements(achievements: Array)

void

remove_scores_from_leaderboards(leaderboards: Array)

void

resume()

void

set_achievement_completed(achievement: GKAchievement)

void

set_progress_on_achievement(achievement: GKAchievement, percentComplete: float)

void

set_score_on_leaderboard(leaderboard: GKLeaderboard, score: int)

void

set_score_on_leaderboard_with_context(leaderboard: GKLeaderboard, score: int, context: int)

void

start()

void

start_with_definition(definition: GKGameActivityDefinition, callback: Callable) static

void

start_with_definition_and_party_code(definition: GKGameActivityDefinition, partyCode: String, callback: Callable) static

PackedStringArray

valid_party_code_alphabet() static


Property Descriptions

Array achievements = [] 🔗

  • Array get_achievements()

Achievements associated with this activity.


GKGameActivityDefinition activity_definition = null 🔗

Definition used to create/configure this activity.


float creation_date = 0.0 🔗

  • float get_creation_date()

Activity creation timestamp (Unix seconds).


float duration = 0.0 🔗

  • float get_duration()

Current activity duration in seconds.


float end_date = 0.0 🔗

  • float get_end_date()

End timestamp (Unix seconds), or 0 while active.


String identifier = "" 🔗

  • String get_identifier()

Unique activity identifier.


float last_resume_date = 0.0 🔗

  • float get_last_resume_date()

Last resume timestamp (Unix seconds).


Array leaderboard_scores = [] 🔗

  • Array get_leaderboard_scores()

Leaderboard scores associated with this activity.


String party_code = "" 🔗

  • String get_party_code()

Party code for joining this activity.


String party_url = "" 🔗

  • String get_party_url()

Party URL for this activity, if available.


Dictionary properties = {} 🔗

  • void set_properties(value: Dictionary)

  • Dictionary get_properties()

Custom properties attached to this activity.


float start_date = 0.0 🔗

  • float get_start_date()

Start timestamp (Unix seconds).


int state = 0 🔗

  • int get_state()

Apple activity-state raw value.


Method Descriptions

void check_pending_game_activity_existence(callback: Callable) static 🔗

Checks whether a pending game activity exists.


GKGameActivity create_with_definition(definition: GKGameActivityDefinition) static 🔗

Creates an activity object from definition.


void end() 🔗

Ends this activity.


void find_match(callback: Callable) 🔗

Finds a realtime GKMatch for this activity.


void find_players_for_hosted_match(callback: Callable) 🔗

Finds players for a hosted-match flow.


float get_progress_on_achievement(achievement: GKAchievement) 🔗

Returns progress percentage for achievement.


GKLeaderboardScore get_score_on_leaderboard(leaderboard: GKLeaderboard) 🔗

Gets this activity’s score entry for leaderboard.


bool is_valid_party_code(partyCode: String) static 🔗

Returns true if partyCode is valid.


GKMatchRequest make_match_request() 🔗

Creates a GKMatchRequest based on this activity.


void pause() 🔗

Pauses this activity.


void remove_achievements(achievements: Array) 🔗

Removes the given achievements from this activity.


void remove_scores_from_leaderboards(leaderboards: Array) 🔗

Removes scores from the specified leaderboards.


void resume() 🔗

Resumes a paused activity.


void set_achievement_completed(achievement: GKAchievement) 🔗

Marks achievement as completed.


void set_progress_on_achievement(achievement: GKAchievement, percentComplete: float) 🔗

Sets progress on achievement to percentComplete.


void set_score_on_leaderboard(leaderboard: GKLeaderboard, score: int) 🔗

Sets score on leaderboard.


void set_score_on_leaderboard_with_context(leaderboard: GKLeaderboard, score: int, context: int) 🔗

Sets score and context on leaderboard.


void start() 🔗

Starts this activity.


void start_with_definition(definition: GKGameActivityDefinition, callback: Callable) static 🔗

Starts an activity from definition.


void start_with_definition_and_party_code(definition: GKGameActivityDefinition, partyCode: String, callback: Callable) static 🔗

Starts an activity from definition and partyCode.


PackedStringArray valid_party_code_alphabet() static 🔗

Returns valid characters for Game Activity party codes.