Search Issue Tracker
Duplicate
Votes
4
Found in
2018.3.0b9
Issue ID
1098759
Regression
No
Optimize Mesh Data Player setting can drastically increase build times
When the Optimize Mesh Data player setting is turned on. A game build can spend a larger than normal amount of time compiling shaders. Event when the shaders are already compiled.
CalculateUsedVertexComponentsSnippetPart in Shader.cpp is run for every shader pass in every material that is on every mesh in the build. This data is also not cached so when there is a large level with many meshes and materials the build times become really slow. It's more prevalent when using HD render pipeline because the shaders have many more variants.
Steps to reproduce - sorry, I trying zipping the project but it was still bigger than the 48 Mb limit from Fogbugz...
- Create a project using the HDRP Template.
- On the SampleScene created, create an empty gameobject, name it root, and move the following under it:
- volume settings
- Workshop set
- Props
- Reflection Probe Main
- Post-Process Volume
- Reflection Probe behind the wall
- Light Probe Group
- Reflection Probe Behind the Frame
- Select the root game object and duplicate/move the duplicated object to create 8 copies total of them (I spaced them in a 4 x 2 pattern - see attached image)
- Open the build Settings dialog (File/Build Settings). Click on the "Player settings..." button and make sure the setting for "Other settings/Optimization/Optimize Mesh Data" is OFF.
- Click on the Build button. Specify a directory. Start measuring time on the moment you click on the "Select Folder" button.
- When the build is done, the file manager will pop up: stop measuring time then.
- This first round can be ignored as the build will take longer as it is caching a ton of stuff.
- Now press the Build button again. Specify a directory. Start measuring time on the moment you click on the "Select Folder" button.
- When the build is done, the file manager will pop up: stop measuring time then. This took 1:57.99 on my machine
- Now turn ON the "Player settings...Other settings/Optimization/Optimize Mesh Data"
- Now press the Build button again. Specify a directory. Start measuring time on the moment you click on the "Select Folder" button.
- When the build is done, the file manager will pop up: stop measuring time then. This took 3:57.5 on my machine
On bigger projects (like the ones that the Spotlight team deals with) this time is much much greater.
-
sj631
Mar 05, 2021 12:29
This is wrongly marked as duplicate.
-
fgeorg_oculus
Feb 12, 2021 03:52
Seeing the same issue on 2019.4.2 with URP
My build times went from 25 minutes down to 85 seconds just by unchecking that box.
-
SpiderJones
Apr 09, 2019 20:57
Build times took 20 minutes, after unchecking OPTIMIZE MESH DATA build time now takes less than a minute.
I was having the same issue described here -> https://forum.unity.com/threads/compiling-shader-variants-taking-ages.527724/
I had this issue with 2018.3.11f1 and 2018.3.12f1 when building for iOS.
-
Jayeson
Mar 05, 2019 22:49
I have reproduced this on 2018.1.0f2, 2018.3.0f2 and 2019.2.0a4.
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
- Search: Inspector section icon is less sharp/more pixelated than other editor icons
- Search description string is always truncated
- [VFX] When Grouped Nodes are converted to Subgraph Operator resulting Graph Node is not included in the Group
- Search window icons are less sharp/more pixelated than other editor icons
- The Inspector can be covered when scaling the horizontal separator bar
This is a duplicate of issue #1090892