Unity-設定color

weixin_34194087發表於2016-10-26

private Quaternion[] rotationValue;

private Color[] colorValue;

voidStart(){

rotationValue = new Quaternion[12];

colorValue = new Color[12];

inti=0;

while(i<rotationValue.Length){

rotationValue[i ]= Random.rotation;

//生成隨機顏色

colorValue[i] = newColor(Random.value,Random.value,Random.value);

Transform child = transform.GetChild(i);

child.rotation=rotationValue[i];

Renderer render=child.GetComponent();

render.material.color=colorValue[i];

i++;

}

}

相關文章