当前位置:网站首页>Unity shader missing problem
Unity shader missing problem
2022-07-23 12:43:00 【LKZ kumuzi plum】
Unity There are several cases of shader loss !
The first one is :
Unity When building a package, it will eliminate unused by default Shader, Will not put useless Shader Package together , If you want to Unity Keep this Shader Not eliminated , take Shader Set to GraphicsSetting-> always included shader in
If there are too many customizations Shader It is impossible to set it manually , Here are the code settings
[MenuItem("Test/ Test settings 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 ();
}
}
}
The second kind
Loss of hot change package Shader
hold Shader Pack into a hot bag , Under the Android editor , load Shader And shader run show pink ( Looking at the material, you can find that it is not missing materials and shader)
But it's normal on the mobile phone .
Why is that ? This is because it is packaged when Android is used as the platform shader It is compiled into the version of Android platform , stay unity Exceptions will occur when running in the editor .
The editor is pc Platform time , The typed package works normally in the editor .
This should be Unity A question of
Pay attention to WeChat public number 【 Prodigal monologue 】 Get more !
边栏推荐
猜你喜欢
随机推荐
Dynamic programming - "coin exchange problem"
剖析Redis集群
第一篇试水--*offer
OSPF综合实验
TCP的粘包问题代码说明
hot 100 动态规划
Configure TX1 system + set to solid-state disk startup
0动态规划 LeetCodde313. 超级丑数
第一类错误离我们有多远
Basic OJ exercise of binary tree-
Unity3D+moba+技能指示器(二)
Vscode configuration
GameFramework:Resource加载,资源加载,依赖加载,任务池,对象池,引用计数
linkerd服务网格调研笔记
Analyze sentinel mode in redis
剑*offer04 重建二叉树
详解TCP的交互数据流和成块数据流
DICOM open source tool library
【读书笔记《凤凰架构》- 构架可靠的大型分布式系统.周志明】(一)
Navicat for MySQL 安装教程


![[AUTOSAR storage stack NVM]](/img/7a/15e01f8ace647b55e11e764dba1b64.png)






