当前位置:网站首页>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 !
边栏推荐
猜你喜欢
随机推荐
HCIP---BGP相关配置
Unity3d:特效对象池,超时删除池内GameObject,GC权值
Basic OJ exercise of binary tree-
HCIP --- HDLC和PPP协议
Vs attribute configuration related knowledge
InheritableThreadLocal与阿里的TransmittableThreadLocal设计思路解析
剑*offer—— 链表逆序
In depth analysis of replication in redis
LeetCode题解汇总
读《凤凰架构》- RPC的历史与知识
Unity鼠标控制摄像机拖拽、旋转、缩放(模拟编辑器摄像机功能)
详解TCP连接的建立
Summary of video coding and decoding related data
Analyze sentinel mode in redis
大白话说说synchronized关键词的三种用法
TCP的粘包问题代码说明
C语言:基于顺序表的学生管理系统,超级详细,全部都有注释,看完不懂来扇我。
Common sorting method - Select Sorting
冒泡排序,快速排序
Hcip --- BGP --- border gateway protocol









