赞
踩
unity中导入spine模型,当模型挂载SkeletonMecanim组件后,发现材质球向shader传值失败,改为SetPropertyBlock后可行。
- //spine模型使用材质球传参数,当spine模型上挂载有SkeletonMecanim的情况下,会传值失败!!!!
- // foreach (var mat in m_SkinMaterials)
- // {
- // int ShenshiIntensity = Shader.PropertyToID("_ShenshiIntensity");
- // mat.SetFloat(ShenshiIntensity, _value);
- // }
-
- int ShenshiIntensity = Shader.PropertyToID("_ShenshiIntensity");
- List<Renderer> rendererList = m_Actor.GetAllRenderer();
- for (int i=0;i<rendererList.Count;++i)
- {
- MaterialPropertyBlock pb = new MaterialPropertyBlock();
- pb.SetFloat(ShenshiIntensity, _value);
- rendererList[i].SetPropertyBlock(pb);
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。