GameMaker Studio · GML · Downloadable content
gmda_getGameContent
Requests one content item by key.
Signature
gmda_getGameContent(key) -> realWhat it does
GETs /gamecontent/<key> with the session headers. The queued content_loaded event carries response, the server envelope { schema_version, generated_at, "<key>": <your uploaded value> }, your uploaded value (a struct, array or primitive) lives at e.response[$ key], not at the top level. The event's tag field echoes the requested key, so a single handler can route several keys. Nothing is cached on disk; store the payload yourself if you need it offline. Returns 1 once dispatched, or 0 when there is no active session.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| key | string | required | The content key you configured in the panel. |
How to call it
Call gmda_getGameContent(key), then read the content_loaded event with gmda_pollEvent(). Switch on the event's tag to tell which key arrived when you request more than one, and read your value with e.response[$ e.tag].
Result event: content_loaded { success, response }
Example
gmda_getGameContent("levels");
// in the Step event, drain the queue:
var e = gmda_pollEvent();
while (!is_undefined(e)) {
if (e.event == "content_loaded" && e.tag == "levels" && e.success) {
load_levels(e.response[$ "levels"]); // your value lives at response[$ key]
}
e = gmda_pollEvent();
}Use cases
- Fetch a level pack on demand.
- Pull event config that is not auto-downloaded.