1、场景中模型的shader丢失
借用网上的诸多方法,将用到的shader 加入到 菜单 Editor => ProjectSettings => GraphicsSettings =>AlwaysIncludeShaders
2、NGUI 图集 shader丢失问题
重新设置NUGI的 shader
举例子
UISprite.cs 中,红色字体为重新赋值Shader,问题得到解决
public void ShowAsWhiteBlack(bool show, bool isDebugShow = false)
{
if (show)
{
if (MogoMaterial == null)
{
//Material mat = new Material(Shader.Find("Mogo/BlackWhite"));
//Material mat = Resources.Load("MogoBlackWhiteMat") as Material;
//mat.mainTexture = material.mainTexture;
//MogoMaterial = mat;
Material mat = new Material(Shader.Find("Mogo/BlackWhiteETC"));
mat.mainTexture = material.mainTexture;
mat.SetTexture("_AlphaTex", material.GetTexture("_AlphaTex"));
m_oriTex = material.mainTexture;
m_oriAlphaTex = material.GetTexture("_AlphaTex");
MogoMaterial = mat;
if (!isDebugShow)
{
RefreshPanel(gameObject);
}
//AssetCacheMgr.GetUIResource("MogoBlackWhiteMat.mat", (go) =>
//{
// Material mat = go as Material;
// mat.mainTexture = material.mainTexture;
// mat.SetTexture("_AlphaTex", material.GetTexture("_AlphaTex"));
// m_oriTex = material.mainTexture;
// m_oriAlphaTex = material.GetTexture("_AlphaTex");
// //Debug.LogError("Here");
// MogoMaterial = mat;
// if (!isDebugShow)
// {
// RefreshPanel(gameObject);
// }
//});
}
else
{
MogoMaterial.mainTexture = m_oriTex;
MogoMaterial.SetTexture("_AlphaTex", m_oriAlphaTex);
if (!isDebugShow)
{
RefreshPanel(gameObject);
}
}
}
else
{
MogoMaterial = null;
RefreshPanel(gameObject);
}
MogoMaterial.shader = Shader.Find(MogoMaterial.shader.name);
}
3、人物模型shader丢失问题
获取到人物 上的SkinnedMeshReanderer 修改为 material.shader = Shader.Find(MogoMateial.shader.name 问题得到解决
唉unity 坑坑坑!!