Пример #1
0
 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);
 }
Пример #2
0
    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);
    }
Пример #3
0
    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));
        }
    }