diff --git a/Assets/LDtkUnity/CHANGELOG.md b/Assets/LDtkUnity/CHANGELOG.md index 85edc5075..1bbc56cf8 100644 --- a/Assets/LDtkUnity/CHANGELOG.md +++ b/Assets/LDtkUnity/CHANGELOG.md @@ -18,6 +18,8 @@ - Updated docs to instruct that a texture should be RGBA32 compression - Made the LDtkComponentLayer ordered before the LDtkIid component - Fixed a possible exception during initialization of LDtkFields +- Fixed a deserialize exception when making a blank LDtk project whereby `defaultEntityWidth` and `defaultEntityHeight` are null when they shouldn't be + - This is a temporary measure and LDtk will fix this problem for LDtk 1.5 ### Breaking Changes - Removed the "De-parent in Runtime" feature from the project importer diff --git a/Assets/LDtkUnity/Runtime/Data/Extensions/LdtkJson.cs b/Assets/LDtkUnity/Runtime/Data/Extensions/LdtkJson.cs index 6e521b711..4574b9bfa 100644 --- a/Assets/LDtkUnity/Runtime/Data/Extensions/LdtkJson.cs +++ b/Assets/LDtkUnity/Runtime/Data/Extensions/LdtkJson.cs @@ -24,7 +24,7 @@ public partial class LdtkJson : ILDtkIid /// /// Default size for new entities /// - [IgnoreDataMember] public Vector2Int UnityDefaultEntitySize => new Vector2Int(DefaultEntityWidth, DefaultEntityHeight); + [IgnoreDataMember] public Vector2Int UnityDefaultEntitySize => DefaultEntityWidth != null && DefaultEntityHeight != null ? new Vector2Int(DefaultEntityWidth.Value, DefaultEntityHeight.Value) : Vector2Int.zero; /// /// Default pivot (0 to 1) for new entities diff --git a/Assets/LDtkUnity/Runtime/Data/Schema/LdtkJson.cs b/Assets/LDtkUnity/Runtime/Data/Schema/LdtkJson.cs index db3d2921a..f1bec3ce2 100644 --- a/Assets/LDtkUnity/Runtime/Data/Schema/LdtkJson.cs +++ b/Assets/LDtkUnity/Runtime/Data/Schema/LdtkJson.cs @@ -76,13 +76,13 @@ public partial class LdtkJson /// Default height for new entities /// [DataMember(Name = "defaultEntityHeight")] - public int DefaultEntityHeight { get; set; } + public int? DefaultEntityHeight { get; set; } /// /// Default width for new entities /// [DataMember(Name = "defaultEntityWidth")] - public int DefaultEntityWidth { get; set; } + public int? DefaultEntityWidth { get; set; } /// /// Default grid size for new layers