public static void ApplySettings(BakerProfile profile, ProceduralMaterial proceduralMaterial, SubstanceImporter substanceImporter) { int width, height, format, loadbehaviour; substanceImporter.GetPlatformTextureSettings(proceduralMaterial.name, profile.platform, out width, out height, out format, out loadbehaviour); width = profile.TargetWidth == 0 ? width : profile.TargetWidth; height = profile.TargetHeight == 0 ? height : profile.TargetHeight; format = profile.format == BakerProfile.Format.Unchanged ? format : (int)profile.format; loadbehaviour = profile.loadingBehaviour == BakerProfile.LoadingBehavior.Unchanged ? loadbehaviour : (int)profile.loadingBehaviour; Debug.Log("Applying Settings to " + proceduralMaterial.name); //Print the name of the material foreach (var property in profile.customFloat) { try { if (proceduralMaterial.HasProceduralProperty(property.Name)) { proceduralMaterial.SetProceduralFloat(property.Name, property.value); } } catch (Exception e) { Debug.LogError(e); } } substanceImporter.SetPlatformTextureSettings(proceduralMaterial, profile.platform, width, height, format, loadbehaviour); substanceImporter.SetGenerateAllOutputs(proceduralMaterial, profile.generateAllMaps); substanceImporter.SaveAndReimport(); //Reimport under the new settings AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }