Search Issue Tracker
By Design
Votes
3
Found in
2019.4
2020.3
2020.3.11f1
2021.1
2021.2
2022.1
Issue ID
1346916
Regression
No
Player crashes after removing a used Define symbol when built via Command line
How to reproduce:
1. Open the attached "case_1346916.zip" project
2. Navigate to Edit/Project Settings/Player/Other Settings/Script Compilation and type "DISABLEINSTANTIATING" in the input field
3. Apply the changes and close the project
4. In the File Explorer, open the %ProjectRoot/Build.bat file with the text editor and insert the correct project path
5. Run the Build.bat file
6. Launch the Player once it's built
Expected result: Player is launched
Actual result: Player crashes
Reproducible with: 2019.4.29f1, 2020.3.14f1, 2021.1.15f1, 2021.2.0b5, 2022.1.0a2
Could not test with: 2022.1.0a3 (build fails)
Notes:
1. Player does not crash if built through the Editor
2. Player does not crash if Define is not removed
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
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note (2022.1.X):
The current behaviour is actually a "By Design" limitation of the scriptable BuildPipeline:
- define symbols apply to both editor code (such as the PerformJenkinsBuild.cs script in that particular case) and player code
- in most of cases, we want to built player to be aligned with what precompilation symbols were used to compile the editor script triggering the build (and that is what the BuildPipeline.BuildPlayer does)
So in that case, the workaround is to split the build scripts in 2 invocations, so that the editor code gets rebuilt with the required define changes before invoking the player build.
We are aware that this behaviour is not documented and have created a ticket to improve documentation on BuildPipeline.BuildPlayer behaviour towards PlayerSettings that can affect both editor and player build.