public static void SaveLevel() { var world = WorldLoader.Write(); var path = EditorUtility.SaveFilePanel ( title: "Save level", directory: Kharynic.Engine.BuildInfo.LocalProjectPath + "/resources/levels", defaultName: "level", extension: "json" ); if (string.IsNullOrEmpty(path)) { return; } if (!path.StartsWith(Kharynic.Engine.BuildInfo.LocalProjectPath)) { throw new ArgumentException($"file access is limited to {Kharynic.Engine.BuildInfo.LocalProjectPath}"); } File.WriteAllText(path, world); }