Studio › Manual › Code and objects

Inspector from code

Put a /// @export comment above an instance variable in an object's Create event and the variable appears in the inspector with a matching control. It is an ordinary comment, so GameMaker compiles the code as before.

/// @export {Real} range(0, 400, 10) Run speed
run_speed = 220;
/// @export {Bool} Double jump
can_double_jump = true;
/// @export {Colour} Tint
tint_colour = #FFD27A;
/// @export options("easy", "normal", "hard") Difficulty
difficulty = "normal";
/// @export {Asset.GMSprite} Portrait
portrait = spr_hd_player_idle;

The comment is /// @export {Type} range(min, max, step) options(...) Label; every part is optional.

WrittenControl
range(min, max[, step])slider with a number field
options("a", "b")drop-down
{Bool}switch
{Colour} or {Color}colour well (writes #RRGGBB)
{String}text field
{Asset.GMSprite}, {Asset.GMObject}, {Asset.GMSound}, {Asset.GMRoom} …asset picker
{Real}, {Int} or nothingnumber field

Without {Type} the type is guessed from the value. Changing a control rewrites only the value after = in Create and saves the file. Variables declared in a parent's Create are shown greyed.

Keys are shown as on the Mac: ⌘ Command, ⌥ Option, ⌃ Control, ⇧ Shift. Studio for Windows shows its own keys beside each menu item.