Quick answer: GameMaker drawing-to-surface code rendering nothing after a window resize? Surfaces are GPU resources lost on context recreation - check surface_exists() and recreate before binding.
Lighting system draws to an off-screen surface. Resize the window and the entire lighting layer goes black.
Guard every bind
if (!surface_exists(lighting_surf)) {
lighting_surf = surface_create(w, h);
}
surface_set_target(lighting_surf);The pattern: check, recreate, bind. Every place that uses a long-lived surface.
Listen for resize events
In Window Resize event, recreate any layout-sized surface. Don't wait for the next draw to discover the loss.
Or use application surface
For simple cases, draw to the application surface (it auto-resizes). Reserve custom surfaces for cases that need different formats or sizes.
“Surfaces are not assets - they're allocations. Treat them like file handles.”
Wrap surface handling in a script that takes a name and gives back a freshly-resized surface. Centralizing the check stops the bug from coming back.