Search Issue Tracker
Won't Fix
Won't Fix in 2022.3.X
Votes
0
Found in
2021.3.27f1
2022.3.2f1
Issue ID
UUM-39993
Regression
No
Conditional compilation directives like #if UNITY_EDITOR are ignored when building the project
Reproduction steps:
1. Open the “compilerErrorOnBuild“ project
2. Open the “SampleScene“ scene
3. Build the project
4. Build And Run the project using the Build Settings window
Expected result: Both builds are successful
Actual result: A build fails due to an error caused in `OnValidate` which is inside a `#if UNITY_EDITOR` directive
Reproduced in: 2020.3.48f1, 2021.3.27f1, 2022.3.2f1
Not reproduced in: 2023.1.0a1, 2023.1.0f1, 2023.2.0a19
Already fixed in: 2023.1.0a1
Reproduced using: Windows 10 (by the reporter), Windows 11, macOS 13.4 (Intel)
Note: The reproduction was inconsistent. E.g. the issue went away after performing a “Reimport All”
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Weight Brush Overlay text is clipped in Sprite Editor
- GameObject Transform scale values reset to their previously saved values when proportions are constrained and certain decimal values are entered in the Inspector
- Asset thumbnails in the Project window stay white when a referenced texture file is deleted and restored
- Crash on PersistentManager::ReadObjectThreaded when calling AssetDatabase.ForceReserializeAssets() multiple times in a row
- Scene becomes dirty when first opening an HDRP Template project
Resolution Note:
OnValidate is called when Scene is loaded.
When we build players, we also first load the scenes in the Editor to know what Assets are used so we only copy what is needed.
OnValidate are only called in the Editor, so thats why the `#if UNITY_EDITOR` do not exclude ty8s c
Resolution Note (2022.3.X):
OnValidate is called when Scene is loaded.
When we build players, we also first load the scenes in the Editor to know what Assets are used so we only copy what is needed.
OnValidate are only called in the Editor, so thats why the `#if UNITY_EDITOR` do not exclude ty8s c