Godot 4 · GDScript · Downloadable content
sync_always_download
Delta-syncs all always_download content, re-fetching only changed keys.
Signature
sync_always_download() -> voidWhat it does
Lists the catalog, then for each always_download item compares the server version with the cached one: unchanged keys are served from the local cache (no network) and changed keys are re-downloaded. Each key's payload arrives via content_loaded(key, data) first; then content_sync_complete fires; updated_keys were re-downloaded, cached_keys were version-matched. Idempotent: it is a no-op while a sync is already in flight, and it auto-runs once when the session becomes ready.
Parameters
This function takes no parameters.
How to call it
Connect content_loaded (per-key payloads) and content_sync_complete (the finish signal) first, then call sync_always_download(). Often unnecessary to call manually since it runs automatically on ready.
Result signal: content_sync_complete(updated_keys: Array, cached_keys: Array)
Example
Gamdato.content_loaded.connect(_on_content)
Gamdato.content_sync_complete.connect(_on_done)
Gamdato.sync_always_download()
func _on_content(key: String, data: Variant) -> void:
if key == "levels": _load_levels(data[key]) # data is the envelope; value at data[key]
func _on_done(updated: Array, cached: Array) -> void:
print("content ready")Use cases
- Force a refresh of all auto-download content after publishing a new version.
- Re-check for content updates without re-downloading unchanged keys.