public ExportPreset ( |
||
material | The ProceduralMaterial whose preset string will be saved. | |
exportPath | string | Path to a folder where the preset file will be saved. The folder will be created if it doesn't already exist. |
return | void |
public void ExportPreset(ProceduralMaterial material, string exportPath)
{
if (material == null)
{
throw new ArgumentException("Invalid ProceduralMaterial");
}
if (exportPath == "")
{
throw new ArgumentException("Invalid export path specified");
}
if (!Directory.CreateDirectory(exportPath).Exists)
{
throw new ArgumentException("Export folder " + exportPath + " doesn't exist and cannot be created.");
}
File.WriteAllText(Path.Combine(exportPath, material.name + ".sbsprs"), material.preset);
}