LoadSubstanceMaterialWithName() public static méthode

public static LoadSubstanceMaterialWithName ( string materialPath, string substanceName ) : Material
materialPath string
substanceName string
Résultat Material
	public static HEU_MaterialData CreateUnitySubstanceMaterialData(int materialKey, string materialPath, string substanceName, int substanceIndex, List<HEU_MaterialData> materialCache,
		string assetCacheFolderPath)
	{
	    // Let's make sure we can find the Unity or Substance material first
	    Material material = null;

	    HEU_MaterialData.Source sourceType = HEU_MaterialData.Source.UNITY;
	    if (!string.IsNullOrEmpty(substanceName))
	    {
		sourceType = HEU_MaterialData.Source.SUBSTANCE;
		material = HEU_MaterialFactory.LoadSubstanceMaterialWithName(materialPath, substanceName);
	    }
	    else if (substanceIndex >= 0)
	    {
		sourceType = HEU_MaterialData.Source.SUBSTANCE;
		material = HEU_MaterialFactory.LoadSubstanceMaterialWithIndex(materialPath, substanceIndex);
	    }
	    else if (!string.IsNullOrEmpty(materialPath))
	    {
		material = HEU_MaterialFactory.LoadUnityMaterial(materialPath);
	    }

	    if (material != null)
	    {
		HEU_MaterialData materialData = ScriptableObject.CreateInstance<HEU_MaterialData>();
		materialData._materialSource = sourceType;
		materialData._materialKey = materialKey;
		materialData._material = material;

		materialCache.Add(materialData);
		return materialData;
	    }
	    else
	    {
		// We can't find the material in Unity, so notify user and use a default one which allows to at least get the geometry in.
		if (string.IsNullOrEmpty(materialPath))
		{
		    HEU_Logger.LogWarningFormat("Empty material name found. Using default material.");
		}
		else if (materialPath.Contains("Resources/unity_builtin_extra"))
		{
		    // Built in material. Don't display error.
		}
		else
		{
		    HEU_Logger.LogErrorFormat("Unable to find {0} material {1}. Using a default material instead. Please check material exists in project and reload asset!", sourceType, materialPath);
		}

		// The materialKey helps uniquely identify this material for further look ups. But we also need to get a valid file name
		// to create the default material, so strip out just the file name.
		string strippedFileName = HEU_Platform.GetFileName(materialPath);
		return CreateMaterialInCache(materialKey, strippedFileName, HEU_MaterialData.Source.UNITY, false, materialCache, assetCacheFolderPath);
	    }
	}