当前位置:网站首页>Unity Shader丢失问题
Unity Shader丢失问题
2022-07-23 05:45:00 【LKZღ木子李】
Unity的着色器丢失有几种情况!
第一种:
Unity构建包时候会默认剔除没有用到的Shader,不会把没用的Shader一起的包的,如果想Unity保留这个Shader不被剔除,将Shader设置到GraphicsSetting-> always included shader中
如果太多自定义Shader不可能手动设置,下面是代码设置
[MenuItem("Test/测试设置included shader", false, 11)]
public static void TestIncludedShader()
{
string[] myShaders = new string[1]{
"Legacy Shaders/Diffuse"
};
SerializedObject graphicsSettings = new SerializedObject (AssetDatabase.LoadAllAssetsAtPath ("ProjectSettings/GraphicsSettings.asset") [0]);
SerializedProperty it = graphicsSettings.GetIterator ();
SerializedProperty dataPoint;
while (it.NextVisible(true)) {
if (it.name == "m_AlwaysIncludedShaders") {
it.ClearArray();
for (int i = 0; i < myShaders.Length; i++) {
it.InsertArrayElementAtIndex(i);
dataPoint = it.GetArrayElementAtIndex (i);
dataPoint.objectReferenceValue = Shader.Find(myShaders[i]);
}
graphicsSettings.ApplyModifiedProperties ();
}
}
}
第二种
热更包丢失Shader
把Shader打包成一个热更包,在安卓的编辑器下,加载Shader和着色器运行显示粉红(查看材质可以发现并不是丢失材质和shader)
但在手机正常。
这是为什么呢?这是因为以安卓为平台打包的时候被打包的shader被编译成安卓平台的版本,在unity编辑器中运行会发生异常。
编辑器是pc平台的时候,打出来的包在编辑器里运行是正常的。
这个应该是Unity的一个问题
关注微信公众号【浪子独白】 获得更多精彩内容!
边栏推荐
- Embedded from entry to mastery (buried) - sharing of ultra detailed knowledge points 1
- Upper and lower case letter conversion
- C语言小项目——学生成绩管理系统
- vscode配置
- switch实现表达式计算
- The CUDA version of pytorch installed by anconda is inconsistent with the CUDA version of the system
- 大小写字母转换
- 0最短路径问题 LeetCode743. 网络延迟时间
- 输入三角形边长,求面积
- Awk programming language
猜你喜欢

Basic OJ exercise of binary tree-

flask项目celery使用redis sentinel中遇到的坑
![[AUTOSAR DEM iv.event memory]](/img/11/78ab6e5e49aa24f061e0f431112fc2.png)
[AUTOSAR DEM iv.event memory]

Three versions and optimization of quick sorting by interval -- friends may not know it

Common sort -- merge sort (recursive and non recursive) + count sort
![[AUTOSAR candrive 1. learn the function and structure of candrive]](/img/f6/662512bddab70e75367d212029fc23.png)
[AUTOSAR candrive 1. learn the function and structure of candrive]
![[AUTOSAR DCM 1. module introduction (DSL, DSD, DSP)]](/img/99/55b3162ad061fbd00145d0b6810592.png)
[AUTOSAR DCM 1. module introduction (DSL, DSD, DSP)]
![[fee of AUTOSAR (difference between nonvolatile memory flash and EEPROM)]](/img/cc/34bfcc450d82befab24173b0cb132d.png)
[fee of AUTOSAR (difference between nonvolatile memory flash and EEPROM)]

Common sort exchange sort

【学习总结】
随机推荐
Using one-way linked list to realize queue
配置TX1的系统 + 设为固态盘启动
冒泡排序,快速排序
Unity3D+moba+技能指示器(二)
Upper and lower case letter conversion
并发编程1-2
数组 LeetCode977. 有序数组的平方
刷题笔记:二叉树剪枝(递归,迭代)
队列与堆的相互实现(纯c实现)
Unity在URP管线下使用TriLib插件加载模型材质不正确的问题
Awk programming language
线程池总结
C语言:详细讲解基于tcp和udp的两种本地通信方式
*offer--2
[AUTOSAR cantp 1. learn the network layer protocol of UDS diagnosis]
C# 自定义集合
Implementation of heap and heap sorting
桌面远程协议-编解码
动态规划——“换硬币问题”
Simply realize the function of stack