diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9cf4d7e..aea3067 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -81,6 +81,7 @@ Improvements
- Added trimming and AOT annotations and made MLEM.Data trimmable
- Store a RuntimeTexturePacker packed texture region's source region
- Use JSON.NET attributes in favor of DataContract and DataMember
+- Allow adding JsonTypeSafeWrapper instances to JsonTypeSafeGenericDataHolder directly
Fixes
- Fixed data texture atlases not allowing most characters in their region names
diff --git a/MLEM.Data/Json/JsonTypeSafeGenericDataHolder.cs b/MLEM.Data/Json/JsonTypeSafeGenericDataHolder.cs
index 85e1d94..2146ced 100644
--- a/MLEM.Data/Json/JsonTypeSafeGenericDataHolder.cs
+++ b/MLEM.Data/Json/JsonTypeSafeGenericDataHolder.cs
@@ -6,6 +6,7 @@ namespace MLEM.Data.Json {
///
/// An represents an object that can hold generic key-value based data.
/// This class uses for each object stored to ensure that objects with a custom get deserialized as an instance of their original type if is not set to .
+ /// Note that, using , adding instances directly is also possible.
///
#if NET7_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The native code for instantiation of JsonTypeSafeWrapper instances might not be available at runtime.")]
@@ -25,7 +26,7 @@ namespace MLEM.Data.Json {
} else {
if (this.data == null)
this.data = new Dictionary();
- this.data[key] = JsonTypeSafeWrapper.Of(data);
+ this.data[key] = data as JsonTypeSafeWrapper ?? JsonTypeSafeWrapper.Of(data);
}
}