public void SwapMaterial(string materialname) { Material m; if (MaterialInfo.FindByName(materials, materialname, out m)) { foreach (Renderer renderer in renderers) { renderer.material = m; } } }