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:

ConstantDescription
os_windowsWindows OS (NOTE: this replaces the deprecated os_win32 constant)
os_uwpWindows 10 Universal Windows Platform
os_linuxLinux
os_macosxMac OS X
os_iosiOS (iPhone, iPad, iPod Touch)
os_androidAndroid
os_ps3Sony PlayStation 3
os_ps4Sony PlayStation 4
os_psvitaSony PlayStation Vita
os_xboxoneMicrosoft XBox One
os_unknownunknown 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