Unity3d中shader属性的控制

Object [] renderers = GameObject.FindObjectsOfType(typeof(Renderer));
int i_max = renderers.Length;
for (int i = 0; i < i_max; i++)
{
	Material[] materials = ((Renderer)renderers[i]).materials;
	int j_max = materials.Length;
	for (int j = 0; j < j_max; j++)
	{
		if (materials[i].shader.name == "Light_Value")
		{
			materials[i].SetFloat("Attend", 10.0f);
		}
	}
}
看不懂的 给我发信 

你可能感兴趣的:(Unity3d中shader属性的控制)