unity3d Multiplatform development Compiler Definitions


Compiler definitions run platform specific code. Using them you can make small differences between various platforms.

  • Trigger Game Center achievements on apple devices and google play achievements on Android devices.
  • Change the icons in menus (windows logo in windows, Linux penguin in Linux).
  • Possibly have platform specific mechanics depending on the platform.
  • And much more...
void Update(){ 

    //code here is only called when running on iPhone

    //code here is only ran in a unity game running on windows outside of the editor

//other code that will be ran regardless of platform


A complete list of Unity compiler definitions can be found here