Search Issue Tracker

By Design

Votes

0

Found in

5.3.2p2

Issue ID

772030

Regression

No

[Asset Bundles][Shaders] When building bundles from a closed scene more shaders get stripped

Assets Management

-

To reproduce:
1. Extract the project ("repro.zip")
2. Go to the Client/Bundles folder and delete its contents.
3. Open attached project
4. Set the platform to iOS.
5. Open the scene "TestScene"
6. From the BugRepro menu click Assets -> Build iPhone
7. Go back to the Client/Bundles folder in Finder. Note the size of the marmoset_shader_mobile bundle. On my machine it's ~500KB.
8. Delete the contents of the Client/Bundles folder.
9. Close Unity.
10. Invoke the asset bundle build script from command line as follows (replacing the paths to point to the correct Unity app and project):

/Applications/Unity/Unity.app/Contents/MacOS/Unity -projectPath /Users/jc/src/projectName/Client5 -buildTarget iOS -quit -batchmode -executeMethod AssetBundler.BuildAssetBundlesiPhone

11. Go back to the Client/Bundles folder in Finder. Notice the size of the marmoset_shader_mobile bundle is significantly smaller than previously. On my machine, it's ~120 KB.

Also reproducible in the Editor if no scene is open, or if another scene is open.

Workaround: Turn on Manual Shader Stripping. To do so open the scene you would like to calculate the Lightmap modes from and in the Graphics Settings inspector (Edit/Project Settings/Graphics) select Manual under Shader stripping/Lightmap modes. Then select 'From current scene'.

Action: Update the Manual for Building Asset Bundles to include information about Shader Stripping. Also create a new Feature Request case to investigate best way to allow Shader Stripping from "other assets" too i.e. Inspector fields or API to be able to include materials/objects to look into.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.