os_type

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

Syntax:

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_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_ps3 Sony PlayStation 3
os_ps4 Sony PlayStation 4
os_psvita Sony PlayStation Vita
os_xboxone Microsoft XBox One
os_unknown unknown OS


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;
   }

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


Back: Operating Systems
Next: os_version
© Copyright YoYo Games Ltd. 2018 All Rights Reserved