public static bool Exists(string name, Component meshRenderer) { foreach (GLexMaterial material in mMaterials) { if (NamesUtil.CleanMaterial(material.mMaterial.name) == name && HasSameMaterialSettings(material.mMaterialSettings, meshRenderer.GetComponent <GLexMaterialSettings>())) { return(true); } } return(false); }
public static GLexMaterial Get(string name, Component meshRenderer) { foreach (GLexMaterial material in mMaterials) { if (NamesUtil.CleanMaterial(material.mMaterial.name) == name && HasSameMaterialSettings(material.mMaterialSettings, meshRenderer.GetComponent <GLexMaterialSettings>())) { return(material); } } Debug.LogError("GLexMaterial.Get: Trying to get " + name + " but it doesn't exists!"); return(null); }
public static GLexMaterial Get(Material material, Component meshRenderer) { string name = NamesUtil.CleanMaterial(material.name); if (Exists(name, meshRenderer)) { return(Get(name, meshRenderer)); } else { return(new GLexMaterial(material, meshRenderer)); } }