[英]How to change game object Material in Unity?
You are changing the material of the Mesh Renderer component of the game object. Hence, get a reference to the Mesh Renderer and change its material.您正在更改游戏 object 的网格渲染器组件的材质。因此,获取对网格渲染器的引用并更改其材质。
red.GetComponent<MeshRenderer>().material = yesil;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.