os_type

This variable holds a different constant depending on the operating system the game is currently being run with.

Syntax:

GML Code Example

os_type;


Returns: Constant


Description

This variable holds one of various constant GameMaker: Studio has to tell you which operating system the game has been created for. Note that this is not necessarily the same as the OS of the device running it, since - for example - your game could be running on an Amazon Fire OS, but will have been built for the Android platform (in which case os_type will be os_android).

The following constants can be returned:

Constant Description
os_windows Windows OS (NOTE: this replaces the deprecated os_win32 constant)
os_win8native Windows 8
os_winphone Windows 8 Phone
os_uwp Windows 10 Universal Windows Platform
os_linux Linux
os_macosx Mac OS X
os_ios iOS (iPhone, iPad, iPod Touch)
os_android Android
os_tizen Tizen (Native or JS)
os_ps3 Sony PlayStation 3
os_ps4 Sony PlayStation 4
os_psvita Sony PlayStation Vita
os_xboxone Microsoft XBox One
os_unknown unknown OS


Example:

GML Code Example

switch (os_type)
    {
    case os_windows: global.Config = 0; break;
    case os_android: global.Config = 1; break;
    case os_linux: global.Config = 2; break;
    case os_macosx: global.Config = 3; break;
    case os_ios: global.Config = 4; break;
    case os_winphone: global.Config = 5; break;
    }
 

The above code checks the OS running the game and sets a global variable accordingly.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here