如何从gameObject中获取所有材质(有些材质有5-10种材质),并为每种材质设置相同的纹理?
public GameObject go;
public Texture texture;
void Start()
{
go.GetComponent<Renderer>().material.SetTexture("_BaseMap", texture);
}发布于 2021-02-12 22:45:18
我有办法做到这点。通过将所有材料放入一个数组中。
Material[] myMaterials = gameObject.GetComponent<Renderer> ().materials;
for (int i = 0; i < myMaterials.Length; i++) {
myMaterials[i].SetTexture ("_BaseColorMap", texture);
}发布于 2021-02-12 22:36:38
public GameObject go,go1,go2;尝试这样做
https://stackoverflow.com/questions/66173631
复制相似问题