Skip to content

Commit

Permalink
fixed bug for deserialize attempt on a blank project containing nulla…
Browse files Browse the repository at this point in the history
…ble values
  • Loading branch information
Cammin committed Oct 23, 2023
1 parent 70124a3 commit 9122ec1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Assets/LDtkUnity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Assets/LDtkUnity/Runtime/Data/Extensions/LdtkJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class LdtkJson : ILDtkIid
/// <value>
/// Default size for new entities
/// </value>
[IgnoreDataMember] public Vector2Int UnityDefaultEntitySize => new Vector2Int(DefaultEntityWidth, DefaultEntityHeight);
[IgnoreDataMember] public Vector2Int UnityDefaultEntitySize => DefaultEntityWidth != null && DefaultEntityHeight != null ? new Vector2Int(DefaultEntityWidth.Value, DefaultEntityHeight.Value) : Vector2Int.zero;

/// <value>
/// Default pivot (0 to 1) for new entities
Expand Down
4 changes: 2 additions & 2 deletions Assets/LDtkUnity/Runtime/Data/Schema/LdtkJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ public partial class LdtkJson
/// Default height for new entities
/// </summary>
[DataMember(Name = "defaultEntityHeight")]
public int DefaultEntityHeight { get; set; }
public int? DefaultEntityHeight { get; set; }

/// <summary>
/// Default width for new entities
/// </summary>
[DataMember(Name = "defaultEntityWidth")]
public int DefaultEntityWidth { get; set; }
public int? DefaultEntityWidth { get; set; }

/// <summary>
/// Default grid size for new layers
Expand Down

0 comments on commit 9122ec1

Please sign in to comment.