Included Files

GameMaker is not just limited to the assets that you add in The Asset Browser. You can also add files to the project as Included Files so that they can then be accessed while the game is running. These are simply files that are included with your game package, so you can do with them what you wish.

What kinds of files you add will depend on what you want to do, but things like JSON files for data and configuration, sprites and background images, or spreadsheets are commonly used as Included Files.

TIP You can also add project files from other software as included files to your GameMaker project and set them to not export to any platforms (so they won't be included with builds of your game). The project files can be opened directly from within the Included Files window and are included when you export your project (see The File Menu).

Adding Included Files

The simplest way to add an Included File is to drag it from your Explorer/Finder into the IDE. You will be asked to confirm whether the dragged file should be added to Included Files. After pressing Yes, the Included Files window will open, containing the file you just added.

Included Files Window

Open The Asset Browser's Extras menu Extras Menu Icon (Fig. 1), to manually open the Included Files window (Fig. 2):

Open The Included Files Editor
Fig. 1
The Included Files Editor
Fig. 2

 

This window only shows you the Included Files that are present in your project. To re-arrange or rename your files, you will need to edit the actual directory where these files are stored.

Clicking on Open In Explorer/Finder will open the datafiles folder in your project directory, which contains all the included files. You can add and remove files in this directory as you wish, and the interface in Included Files will automatically update to reflect the structure in your datafiles folder. Click the refresh button  to instantly refresh the directory's contents.

Included Files Example

Included File Properties

Once you have added files to the editor, you can double-click LMB Icon on them to open up the Included File Properties in The Inspector

Included Files PropertiesThis window shows the name of the file, its size on disk, and also the platforms that it should be exported to when you compile/test your game. You have buttons to select All or None, or you can go down the list and check/uncheck the targets that you want the file to be exported to.

NOTE The Default option for opening included files under External Editors determines what action to use when a file is double-clicked LMB Icon.

Right-click Menu

Right-clicking LMB Icon brings up the context menu: 

The following menu items are available anywhere you click: 

The following options are only shown when you right-click LMB Icon a file: 

 

For further information on how Included Files are stored with your game and how they are accessed, please see The File System.

IMPORTANT When including sound files, you should ensure that the files avoid names that clash with streaming sound assets. For example, a sound asset called "main_music" will cause an Included File called "main_music.ogg" to become undefined when the project runs. This is because streamed files are also stored outside of the main project bundle, so care must be taken in these situations.

You can also include DLL (on Windows) or DyLib (on macOS) files as Included Files and then create your own custom functions to deal with them using external_define. These can then be used calling the external_call function.

NOTE Using Included Files to create extra functionality in this way is incompatible with the Extension system, as you cannot use use the external_* functions with files added in an extension. Extensions assets already have a method of adding constants and functions.