void loadSettingsFromJson(string file) { string json = File.ReadAllText(file); MeshCreationExportSettings export = JsonUtility.FromJson <MeshCreationExportSettings>(json); AlwaysDrawBottomCube = export.AlwaysDrawBottomCube; BlurRotation = export.BlurRotation; ColorScaling = export.ColorScaling; ColorOffset = export.ColorTranslation; HeighGradient = export.HeighGradient; Invert = export.Invert; MaxHeight = export.MaxHeight; Threshold = export.Threshold; VisualisationMethod = export.VisualisationMethod; }
void safeFile(string file) { SaveSettings(); MeshCreationExportSettings export = new MeshCreationExportSettings(); export.AlwaysDrawBottomCube = AlwaysDrawBottomCube; export.BlurRotation = BlurRotation; export.ColorScaling = ColorScaling; export.ColorTranslation = ColorOffset; export.HeighGradient = HeighGradient; export.Invert = Invert; export.MaxHeight = MaxHeight; export.Threshold = Threshold; export.VisualisationMethod = VisualisationMethod; string json = JsonUtility.ToJson(export); string path = file; File.WriteAllText(path + ".json", json); }