diff --git a/MLEM.Data/ContentExtensions.cs b/MLEM.Data/ContentExtensions.cs index 7fc4165..2801a20 100644 --- a/MLEM.Data/ContentExtensions.cs +++ b/MLEM.Data/ContentExtensions.cs @@ -53,10 +53,12 @@ namespace MLEM.Data { /// The content manager to load content with /// The name of the file to load /// The file extensions that should be appended, or ".json", ".json5" and ".jsonc" by default. + /// The json serializer to use, or by default. /// The type of asset to load /// The loaded asset - public static T LoadJson(this ContentManager content, string name, string[] extensions = null) { + public static T LoadJson(this ContentManager content, string name, string[] extensions = null, JsonSerializer serializer = null) { var triedFiles = new List(); + var serializerToUse = serializer ?? content.GetJsonSerializer(); foreach (var extension in extensions ?? JsonExtensions) { var file = Path.Combine(content.RootDirectory, name + extension); triedFiles.Add(file); @@ -64,7 +66,7 @@ namespace MLEM.Data { continue; using (var stream = File.OpenText(file)) { using (var reader = new JsonTextReader(stream)) { - return GetJsonSerializer(content).Deserialize(reader); + return serializerToUse.Deserialize(reader); } } }