GameMaker Studio · GML · Downloadable content
gmda_syncAlwaysDownload
Fetches every always_download item: emits one content_loaded per item, then content_sync_complete.
Signature
gmda_syncAlwaysDownload() -> realWhat it does
GETs /gamecontent/list with the session headers, then fetches every item whose category is "always_download". It emits more than one event: first content_list_loaded { success, response } with the catalog, then one content_loaded { success, response } per always_download key (the event's tag field is that key, and response is the envelope { schema_version, generated_at, "<key>": <your value> }, read your value at e.response[$ e.tag]), and finally content_sync_complete { success } once they are all requested. Nothing is cached on disk; store the payloads yourself if you need them offline. Returns 1 once dispatched, or 0 when there is no active session.
Parameters
This function takes no parameters.
How to call it
Call gmda_syncAlwaysDownload(), then in your Step loop read both events with gmda_pollEvent(): handle each content_loaded to store a key's payload (e.response[$ e.tag]), and watch for content_sync_complete to know the batch is done.
Result event: content_sync_complete { success }
Example
gmda_syncAlwaysDownload();
// in the Step event, drain the queue:
var e = gmda_pollEvent();
while (!is_undefined(e)) {
switch (e.event) {
case "content_loaded":
if (e.success) store_content(e.tag, e.response[$ e.tag]); // value at response[$ key]
break;
case "content_sync_complete":
show_debug_message("content ready");
break;
}
e = gmda_pollEvent();
}Use cases
- Force a refresh of all always_download content after publishing a new version.
- Pull every auto-download key at startup and react once the sync finishes.