Skip to main content

Scripting Defines

In your game code you may wrap certain features in Scripting Defines; this code will only be compiled and run in certain conditions or platforms, such as specific Unity Versions.

Check out some more information about preprocessor directives and the list of defines supported by Unity.

If you wish to include certain scripting defines in your Luna builds, you can enter these pre-processor symbols into the Scripting Defines section in the Luna UI, under Source code.

Example

#if  UNITY_2017_1_OR_NEWER
//...Your Awesome Code...//
#endif
If code wrapped with scripting defines exists in your code, which is required in your Luna build you should also include them in the `Scripting Defines` tab in the Luna UI. Otherwise they wont be compiled.

Then include the name space inside the Luna Window. Navigate to the Code section and the Scripting Defines tab.

luna-ui-code

Although you are able to select which ones are to be picked up during compilation, Luna implements scripting defines default namespaces that are pre-included in the Luna engine: UNITY_LUNA; UNITY_BUPC; UNITY_5_4_OR_NEWER;

Luna respects specific Unity version for scripting defines.

Let's use an example to fully undestand it:

  • While the UNITY_2018 will function if you are running Unity 2018, this will be skipped when running another version like Unity 2019.