The gml_pragma function affects how the given target compiles your code and should be called with the different commands to further optimise the final compilation of your project. These commands are effectively pre-processed before the game is compiled and so the function can be placed anywhere in your project and it will still be processed before the game is fully compiled. The available commands are as follows:
gml_pragma("global", "Init()");
This will call the script function "Init" before the first room of the game is run. Note that the GML supplied as the second argument must be a compile time constant, and also note that you cannot use this pragma to create instances or perform any operations that require a room (or anything in a room) to function.gml_pragma("Texgroup.Scale", "level1", "2");
This will half all the textures in the "level1" texture group.gml_pragma("UnityBuild", "true");
The benefit of doing a unity build is that builds are faster but the down side is that it does a full build each time so even if you change a single part of the code it will build everything again without using any cached files. This has been added specifically for the Xbox One export using the YYC although it can be called for other builds (YYC only). For more information on unity builds, please see here.NOTE: The first argument to the gml_pragma function must be a compile time string constant and not a variable.
gml_pragma(command, [optional...]);
| Argument | Description |
|---|---|
| command | A string with one of the commands listed below. |
| [optional] | Some of the available commands require an optional argument or arguments. These are explained below for each command. |
N/A
gml_pragma("forceinline");
The above example code will force the script function where it is used to be in-lined on compile.