material.setTexture("sampler",tex) assetbundle 下失效

做镜面反射本来写很顺 在手机上测的时候 发现settexture这里绑不上

查好久

是assetbundle的缘故 因为动态加载的 obj用了mat01

我在反射脚本里动态修改mat01而不是拿

 reflective = GameObject.Find("Plane");

reflective.GetComponentInChildren<MeshRenderer>().materials[0].SetTexture("_MainTex", reflectionCamera.targetTexture);

这样 其实操作与两个mat01的副本 

这个问题好难查啊 之前只有手机才能重现 我就测一次打个包

再之前 log 看每行代码走没走。。。

solution:把mat单独打assetbundle

写个大的东西 再出点小问题就好难查。。要把所有东西都排查一遍  还是迭代好

原文地址:https://www.cnblogs.com/minggoddess/p/9082793.html