UNT0043 Possible typo in conditional compilation symbol

May 18, 2026 ยท View on GitHub

Mistyped conditional compilation symbols in #if and #elif directives are treated as undefined, so the affected branch can be compiled or skipped unexpectedly without a compiler error.

Examples of patterns that are flagged by this analyzer

#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITTY_STANDALONE_OSX
    InitializeServiceLocator();
#endif

If the project defines UNITY_STANDALONE_OSX, UNITTY_STANDALONE_OSX is reported as very close to that project-level preprocessor symbol. The analyzer gets this symbol set from Roslyn's parse options for the project.

The same applies to custom project symbols:

#if FEATURE_RELEAS
    EnableReleaseFeature();
#endif

If the project defines FEATURE_RELEASE, this is reported as a likely typo.

Solution

Use the intended symbol name:

#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITY_STANDALONE_OSX
    InitializeServiceLocator();
#endif

A code fix is offered for this diagnostic to replace the mistyped symbol with the suggested project-level symbol.