Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ManagedCodeVariant

Defines how C# code in the project is compiled when exporting a build.
Read time 1 minuteLast updated 5 days ago

Definition

  • Type: Enum
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule
public enum ManagedCodeVariant

Remarks

Each variant level is inclusive of the next level. For example, the Debug variant has Unity checks enabled, whereas the Checked variant has Instrumented code paths enabled. You can configure the managed code variant in a Unity project through the Player Settings or via PlayerSettings.GetManagedCodeVariant and PlayerSettings.SetManagedCodeVariant.
For more information on managed code variants, refer to Adding diagnostics to C# code.

Fields

Value

Description

CheckedCompiles C# code with optimizations. Defines UNITY_ENABLE_CHECKS, UNITY_ASSERTIONS and all the same defines as ManagedCodeVariant.Instrumented. Used for running the game with extra checks enabled.
DebugCompiles C# code without optimizations. Defines DEBUG and all the same defines as ManagedCodeVariant.Checked. Used for debugging the code with a debugger.
InstrumentedCompiles C# code with optimizations. Defines UNITY_INCLUDE_INSTRUMENTATION and ENABLE_PROFILER. Used for profiling.
ReleaseCompiles C# code with optimizations. Used for running with all unnecessary code paths disabled and for shipping releases to users.