在Unity中要设置物体的颜色需要如下操作:
GameObject cube = GameObject.Find("cube");
if(cube != null)
{
Renderer render = cube.GetComponent<Renderer>();
render.material.color = Color.green;
}
在Unity中要设置物体的颜色需要如下操作:
GameObject cube = GameObject.Find("cube");
if(cube != null)
{
Renderer render = cube.GetComponent<Renderer>();
render.material.color = Color.green;
}