public static List <UnityEngine.Material> GetMaterials(Mesh mesh) { List <UnityEngine.Material> materials = new List <UnityEngine.Material>(); List <Material> mmMaterials = mesh.materials.GetMaterials(); foreach (Material mmMaterial in mmMaterials) { UnityEngine.Material material = MaterialCache.MaterialByColor(mmMaterial.color, mesh.GetRenderMesh(), mesh.GetRenderWireframe(), mesh.GetRenderNormals()); materials.Add(material); } return(materials); }
public static UnityEngine.Material MaterialToInstance(Mesh mesh, Material material, bool noWireframe = false) { return(MaterialCache.MaterialByColor(material.color, mesh.GetRenderMesh(), mesh.GetRenderWireframe(), mesh.GetRenderNormals())); }