Skip to reading
GDScript Programming & Godot

PCA events: all shared hooks

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page
On this page

Earlier edition reference / Current 0.86.4.0 property paths > p. 350

Native records subscribe through the editor’s Event Functions checkboxes. Each shared hook calls the matching on_* method. A method that is merely named on_scene_loaded does not automatically subscribe itself.

The event Dictionary depends on the emitter. The keys below describe standard runtime emitters; optional/local routes can supply different data. Read optional values with get and an appropriate fallback.

A global native instance defining on_global_ready receives PCA’s deferred ready call after binding. That special initialization route differs from an ordinary broadcast subscription.

OnGameStart#

Code example
func on_game_start(event: Dictionary = {}) -> void:
    Log(ToJSON(event))

The runtime reaches its game-start hook. It is a game-session event, not a once-per-room event.

Source table from PCA events: all shared hooks, page 295
Common contextUse and limits
sceneId, playerIdInitialize session-level logic here. Do not reset saved puzzle variables on every scene entry. A direct Test Scene can start a test session too; test a normal new game and a loaded game separately.

OnSceneLoaded#

Code example
func on_scene_loaded(event: Dictionary = {}) -> void:
    Log(ToJSON(event))

A room has been constructed and its local entry actions have run.

Source table from PCA events: all shared hooks, page 295
Common contextUse and limits
sceneId, previousSceneId, playerId, firstVisitFilter sceneId before changing room-specific props. In the normal entry path, firstEnter runs before enter, then this event is emitted. It is not a substitute for the room's first-time event.
Page 295 of 378Permalink
Go to page