环境:unity3d
这样替换材质无效
var mat = BResources.Load<Material>("Map/MonsterMat/SpineUnlit");
var render = spine.GetComponent<Renderer>();
for (int i = 0; i < render.materials.Length; i++)
{
var unlitMat = Material.Instantiate(mat);
var oldMat = render.materials[i];
render.materials[i] = unlitMat;
//
MaterialPropertyBlock mpb = new MaterialPropertyBlock();
mpb.SetTexture("_MainTex",oldMat.mainTexture);
render.SetPropertyBlock(mpb,i);
}