Unity3D打包Assetbundle丢失Shader问题

详情见:https://www.pianshen.com/article/5391338163/

1、Unity3D在打包Assetbundle时,可能会遇到Shader丢失的问题,解决方法:打开Edit->Project Settings->Graphics,在Always Included Shaders列表添加上所需的shader,再打包即可。

2、参考

3、原文复制

Graphics Settings

Scriptable RenderLoop settings

This is an experimental setting which allows you to define a series of commands to control exactly how the Scene should be rendered (instead of using the default rendering pipeline used by Unity). For more information on this experimental feature, see the Scriptable Render Pipeline documentation on GitHub.

这是一个实验设置,允许您定义一系列命令来精确控制场景的渲染方式(而不是使用Unity使用的默认渲染管道)。有关此实验功能的详细信息,请参见GitHub上的可脚本呈现管道文档。可编程渲染管线

Camera settings

These properties control various rendering settings.

这些属性控制各种渲染设置。

Setting:

Description:

Transparancy Sort Mode

透明性排序模式

Renderers in Unity are sorted by several criteria such as their layer number, or their distance from camera. Transparency Sort Mode adds the ability to order renderable objects by their distance along a specific axis. This is generally only useful in 2D development; for example, sorting Sprites by height or along the Y axis.

Unity 中的渲染器按几个标准排序,例如层号或与摄影机的距离。透明度排序模式增加了按可渲染对象沿特定轴的距离排序的功能。这通常只在二维开发中有用;例如,按高度或沿Y轴对精灵排序

Default

Sorts objects based on the Camera mode.

Perspective

Sorts objects based on perspective view.

Orthographic

Sorts objects based on orthographic view.

Transparancy Sort Axis

Use this to set a custom Transparency Sort Mode.

Tier settings

These settings allow you to make platform-specific adjustments to rendering and shader compilation, by tweaking builtin defines. For example, you can use this to enable Cascaded Shadows on high-tier iOS devices, but to disable them on low-tier devices to improve performance. Tiers are defined by Rendering.GraphicsTier.

这些设置允许您通过调整内置定义对渲染和着色器编译进行特定于平台的调整。例如,您可以使用它在高层iOS设备上启用级联阴影,但在底层设备上禁用它们以提高性能。层由rendering.graphictier定义。

Built-in shader settings内置的shader设置

These settings allow you to specify which shader is used to do lighting pass calculations in deferred shading and legacy deferred lighting rendering paths, respectively.

这些设置允许你指定在deferred shading(Deferred Shading是现在比较流行实时渲染方式,这种渲染方式能把Geometry和Lighting之间的耦合解开,把Forward Shading的Geometry Pass*Lighting Pass复杂度下降为Geometry Pass+Lighting Pass,特别适合于渲染较多动态光源的场景)和legacy deferred lighting中哪些shader被用于光照通道的计算。

Setting:设置

Description:描述

Built-in shader(Default value)

Use Unity’s built-in shaders to do the calculation.

Custom shader定制shader

Use your own compatible shader to do the calculation. This enables you to do deep customization of deferred rendering.用你自己的兼容的shader用于计算。这样你就可以深度定制 deferred rendering。

No Support不支持

Disable this calculation. Use this setting if you are not using deferred shading or lighting. This will save some space in the built game data files.关闭计算。如果你没有使用 deferred shading或者 lighting。这将会节省你构建游戏数据文件的空间。

Always-included Shaders一直包括的shader

Specify a list of Shaders that will always be stored along with the project, even if nothing in your scenes actually uses them. It is important to add shaders used by streamed AssetBundles to this list to ensure they can be accessed.

指定一个将会一直存在工程中的shader列表,即使你的场景中没有任何东西使用它们。对于assetbundlle中用到的 shader 把他们加到这个list中非常重要,可以防止shader丢失。 (当需要导出的资源中使用的是内置的shader的时候需要注意这个)

Shader strippingshader剥离(根据当前打开场景的光照贴图模式和雾的模式把导出的shader中没有用到的shader variants剔除掉不导出,可能导致光照丢失和雾丢失的问题

Lower your build data size and improve loading times by stripping out certain shaders involved with lighting and fog.降低打包的数据大小和通过剥离光照和雾中涉及的特定的shader提高加载的速度。

Setting:

Description:

Automatic(Default value)自动

Unity looks at your scenes and lightmapping settings to figure out which fog and lightmapping modes are not in use, and skips corresponding shader variants.unity查看你的场景和光照贴图的设置来知道哪些雾和光照贴图的模式没有用到,然后剥离相关的shader variants.

Manual手动

Specify which modes to use yourself. Select this if you are building asset bundles or changing fog modes from a script at runtime, to ensure that the modes you want to use are included.指定哪些模式你用到了。如果你导出assetbundle或者会用脚本在运行时修改模式,来确保你将要用到的模型被包括了。

Shader preloading shader预加载

Specify a list of shader variant collection assets to preload while loading the game. See Optimizing Shader Load Time page for details.

猜你喜欢

转载自blog.csdn.net/WenHuiJun_/article/details/128587641