public static VertexAttributeMappingPreset ReadPreset(string name) { string path = VertexAttributeMapping.GetPresetFullPath(name); if (System.IO.File.Exists(path)) { var json = System.IO.File.ReadAllText(path); if (!string.IsNullOrEmpty(json)) { VertexAttributeMappingPreset preset = new VertexAttributeMappingPreset(); EditorJsonUtility.FromJsonOverwrite(json, preset); return(preset); } } return(null); }
public static void SavePreset(VertexAttributeMappingPreset preset, string name) { if (preset == null) { return; } if (string.IsNullOrEmpty(name)) { return; } if (!System.IO.Directory.Exists(VertexAttributeMapping.preferencesPath)) { System.IO.Directory.CreateDirectory(VertexAttributeMapping.preferencesPath); } string path = VertexAttributeMapping.GetPresetFullPath(name); var json = EditorJsonUtility.ToJson(preset, true); System.IO.File.WriteAllText(path, json); }