A downloadable extension

Download NowName your own price

Quick links: source code
Versions: GameMaker: Studio, GameMaker Studio 2
Platforms: Windows, Windows (YYC) (see this extension for HTML5)

This extension allows the user to drag-and-drop files and directories onto the game window!

Featuring a total of 1 (one) function:

file_dropper_init()➜ Sets up the drag and drop operations for the game window. Should be called before you expect user to attempt dragging and dropping objects onto the window (usually on Game Start). Harmless if called more than once. Returns whether successful (I'm not aware of circumstances that could cause this function to fail).

After calling the said function, the game window will indicate to the system that it's happy to accept objects and the user will be able to drag and drop files from Explorer/etc. Doing so will dispatch one Async - System event per file, where

  • async_load[?"event_type"] is "file_drop"
  • async_load[?"filename"] is an absolute path to the file
    Note that in GMS1.4, you'll need an extension to read files outside of game/save directory (e.g. non-sandboxed filesystem)

Made available for free thanks to Follow The Fun (see more)


Download NowName your own price

Click download now to get access to the following files:

file_dropper-for-GMS1.gmez 57 kB
Version 1.0.0
file_dropper-for-GMS2.yymp 67 kB
Version 1.0.0
file_dropper-for-GMS2.3+.yymps 129 kB
Version 1.0.0


Log in with itch.io to leave a comment.

(5 edits) (+1)

Helper script:

To use this extension, simply call this once at launch: 
Then, put the following code in an async -> System event
Object -> Click "Add event"
"Asynchronous" (bottom right)
"System event" (last on the list).
// Check to see what kind of event happened
var eventType = ds_map_find_value(async_load,"event_type");
// If a file was dropped over the window
if eventType == "file_drop"
    // This is the absolute path
    var filePath = ds_map_find_value(async_load,"filename");
    // Print it 
    // Will return the full path, e.g. "C:\Users\user\Documents\Test.txt"
    // When multiple files are included, this event will be called
    // once per file. 

Nice! Very easy to use.