Skip to reading
GDScript Programming & Godot

OnSaveLoaded

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

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

A save has successfully restored game state.

Source table from OnSaveLoaded, page 299
Common contextUse and limits
slot, sceneId, playerIdRefresh presentation from restored variables. Do not award a pickup again merely because its saved state was loaded. This is a successful-load hook; a missing or invalid save should not be treated as a completed restore.

OnCustomEvent#

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

A script or Emit Event graph node explicitly emits this event name.

Source table from OnSaveLoaded, page 299
Common contextUse and limits
Whatever keys the emitter sends; eventName is added for the listenerUse a reason key, such as signal_powered, to distinguish several messages sharing OnCustomEvent. It is not automatically emitted by every button or variable edit. The graph form uses its Context JSON; the GDScript helper merges its current caller context before emitting.

OnGlobalReady#

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

A persistent/global script is initialized through its language runtime's ready route.

Source table from OnSaveLoaded, page 299
Common contextUse and limits
Language-specific startup context; native GDScript includes eventName and scriptIdUse it to initialize that global instance, not to assume a playable room is ready. The GDScript runtime calls a global script's matching method directly. The visual On Event picker does not offer this ready event; do not design it as a universal room-ready graph broadcast.
Page 299 of 378Permalink
Go to page