gml_release_mode


描述

When your game is compiled, it also includes certain internal functions to error check while running. These internal checks cover many aspects of a games code, including ranges, parameters and some general aspects of the internal GML compiler and are what spawn the final error messages in many cases. However this function can be used to switch these internal checks off (ie: remove them completely from the compiled game), giving a speed boost to your final project.

Please note that this means that should you do something in your game code that is incorrect, the compiled game may simply crash, or it may experience some very unexpected behaviour. For example, if a ds_grid is accessed at a coordinate outside of the defined size, in developer mode you would get a compiler window error message but the checks in place would permit the game to continue running. However in release mode these checks will not be there and so the code could return either a NULL pointer, or a bad pointer which in turn will point to some random memory. So at best you could get the wrong data returned, or at worst you could overwrite something in memory - data, graphics, or even code itself. Another example would be when building primitives - if you supply the colour, position, texture, etc... data in a different order to that which you defined when you created the vertex format, then the game may crash or produce unexpected results when release mode is on.


语法:

gml_release_mode(flag);

参数 描述
标识 Either true to set release mode or false for general development.


返回:

N/A(无返回值)


例如:

gml_release_mode(true);

The above example code will set the game to use release mode when compiled.