Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Conditional compilation

Use and define preprocessor directives to selectively include or exclude sections of your code for compilation.
Read time 1 minuteLast updated 8 days ago

This section covers the use of preprocessor directives and scripting symbols to conditionally compile sections of your C# code.

Topic

Description

Conditional compilation in UnityAn overview of how and when to use conditional compilation in your Unity scripts.
Unity scripting symbol referenceA reference of the predefined scripting symbols Unity provides.
Custom scripting symbolsCreate your own custom scripting symbols via the Editor UI, from scripts, or with an asset file.
Test conditional compilationCode example and steps to test your conditionally compiled code.

Additional resources