Quick answer: Order is instance Create → room Creation Code → instance Room Start. For globals needed in Create, use a persistent init controller from the first room or set values via Game Start event.
A level’s Creation Code sets global.difficulty = 2. Placed instances’ Create events read difficulty and configure stats. Stats are wrong because Create runs first; difficulty was still its previous value at that moment.
Event Order in a New Room
- All placed instances fire Create event (in some order).
- Room Creation Code runs.
- All instances fire Room Start event.
So Creation Code is too late to influence Create-time logic. The fix is either to init earlier or to defer instance logic to Room Start.
Option 1: Init Controller
Place a single obj_init controller in the first room of the game (persistent). Its Create event sets global variables. Subsequent room loads don’t recreate it (persistent); globals remain.
/// obj_init Create
persistent = true;
if (instance_number(obj_init) > 1) { instance_destroy(); exit; }
global.difficulty = 2;
global.gravity = 0.5;
Option 2: Game Start Event
Each object can have a Game Start event — fires once when the game launches, before any room. Use for true app-init logic:
/// obj_anything Game Start (rarely used but powerful)
global.config = init_config();
Option 3: Move Instance Logic to Room Start
If your instances can defer their setup until after Creation Code:
/// obj_enemy Room Start
hp = max(10, 20 * global.difficulty); // safe; global is set
Room Start runs after Creation Code, so globals are populated. Some logic must stay in Create (positioning, sprite setup); others can move to Room Start.
Verifying
Print global.difficulty at the top of obj_enemy.Create and obj_enemy.RoomStart. Confirm Create sees the previous value and RoomStart sees the new one. Plan instance logic accordingly.
“Create runs before Creation Code. If you need globals at Create time, set them earlier in an init controller or Game Start.”
Document the event order in your project README — new contributors won’t guess it correctly and the bug is subtle.