diff --git a/Assets/LDtkUnity/Editor/Utility/Artifacts/LDtkConfigData.cs b/Assets/LDtkUnity/Editor/Utility/Artifacts/LDtkConfigData.cs index e58465b8..228212f0 100644 --- a/Assets/LDtkUnity/Editor/Utility/Artifacts/LDtkConfigData.cs +++ b/Assets/LDtkUnity/Editor/Utility/Artifacts/LDtkConfigData.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Text; +using UnityEditor; using UnityEngine; namespace LDtkUnity.Editor @@ -23,7 +24,7 @@ internal struct LDtkConfigData internal string WriteJson(string projectAssetPath) { string writePath = GetPath(projectAssetPath); - string json = JsonUtility.ToJson(this, true); + string json = EditorJsonUtility.ToJson(this, true); byte[] byteArray = Encoding.UTF8.GetBytes(json); LDtkPathUtility.TryCreateDirectoryForFile(writePath); @@ -41,7 +42,10 @@ internal static LDtkConfigData ReadJson(string assetPath) byte[] bytes = File.ReadAllBytes(assetPath); string json = Encoding.UTF8.GetString(bytes); - return JsonUtility.FromJson(json); + + LDtkConfigData data = new LDtkConfigData(); + EditorJsonUtility.FromJsonOverwrite(json, data); + return data; } internal static string GetPath(string projectAssetPath) diff --git a/Assets/LDtkUnity/Samples~/Samples/SeparateLevelFiles/SeparateLevelFiles_Config.ldtkc b/Assets/LDtkUnity/Samples~/Samples/SeparateLevelFiles/SeparateLevelFiles_Config.ldtkc index 3836910e..7b65795a 100644 --- a/Assets/LDtkUnity/Samples~/Samples/SeparateLevelFiles/SeparateLevelFiles_Config.ldtkc +++ b/Assets/LDtkUnity/Samples~/Samples/SeparateLevelFiles/SeparateLevelFiles_Config.ldtkc @@ -13,7 +13,9 @@ { "_key": "IntGrid_1", "_asset": { - "instanceID": 22226 + "fileID": 11400000, + "guid": "85c839224be7398449b593cedc9d81ca", + "type": 2 } } ], diff --git a/Assets/Tests/Misc/OtherTechTests/DependencyTest/TestIntGridValueDependency/TestIntGridValueDependency_Config.ldtkc b/Assets/Tests/Misc/OtherTechTests/DependencyTest/TestIntGridValueDependency/TestIntGridValueDependency_Config.ldtkc index 1e9b3d3b..96ee7f61 100644 --- a/Assets/Tests/Misc/OtherTechTests/DependencyTest/TestIntGridValueDependency/TestIntGridValueDependency_Config.ldtkc +++ b/Assets/Tests/Misc/OtherTechTests/DependencyTest/TestIntGridValueDependency/TestIntGridValueDependency_Config.ldtkc @@ -13,19 +13,25 @@ { "_key": "IntGrid_1", "_asset": { - "instanceID": 29410 + "fileID": 11400000, + "guid": "019c844af99991d409a134bcc556b3b1", + "type": 2 } }, { "_key": "IntGrid_2", "_asset": { - "instanceID": 28118 + "fileID": 11400000, + "guid": "aee5cec04e488604cb16a7da061946bc", + "type": 2 } }, { "_key": "IntGrid_3", "_asset": { - "instanceID": 24110 + "fileID": 11400000, + "guid": "62504a226f3487f49af1e37703e72136", + "type": 2 } } ], diff --git a/Assets/Tests/Misc/OtherTechTests/LevelsVania/LevelsVania_Config.ldtkc b/Assets/Tests/Misc/OtherTechTests/LevelsVania/LevelsVania_Config.ldtkc index b579707c..12dd7638 100644 --- a/Assets/Tests/Misc/OtherTechTests/LevelsVania/LevelsVania_Config.ldtkc +++ b/Assets/Tests/Misc/OtherTechTests/LevelsVania/LevelsVania_Config.ldtkc @@ -13,7 +13,9 @@ { "_key": "Collisions_1", "_asset": { - "instanceID": 25948 + "fileID": 11400000, + "guid": "608aedeab5fb3ac48959b083b4ecd7c1", + "type": 2 } }, { @@ -27,37 +29,49 @@ { "_key": "Item", "_asset": { - "instanceID": 30982 + "fileID": 6381717676898315408, + "guid": "154ba3503afd20d4580ff3f817fd2177", + "type": 3 } }, { "_key": "Player", "_asset": { - "instanceID": 33704 + "fileID": 6381717676898315408, + "guid": "2c40888790883084b832d4183474c09a", + "type": 3 } }, { "_key": "Exit", "_asset": { - "instanceID": 31998 + "fileID": 6381717676898315408, + "guid": "109ac9123036bb24ca5866d7aa81f4b3", + "type": 3 } }, { "_key": "SecretArea", "_asset": { - "instanceID": 31288 + "fileID": 6381717676898315408, + "guid": "455e2726c152eb946bab81090f7c0afa", + "type": 3 } }, { "_key": "Teleport", "_asset": { - "instanceID": 30554 + "fileID": 6381717676898315408, + "guid": "9958dbc3bfc14c64ba545adf3467ed50", + "type": 3 } }, { "_key": "Ladder", "_asset": { - "instanceID": 30794 + "fileID": 6381717676898315408, + "guid": "4bd923e45ce962547bb6ae2dd76a5984", + "type": 3 } } ] diff --git a/Assets/Tests/Misc/OtherTechTests/TestAllFieldsLevels/TestAllFieldsLevels_Config.ldtkc b/Assets/Tests/Misc/OtherTechTests/TestAllFieldsLevels/TestAllFieldsLevels_Config.ldtkc index d083fc40..00b42870 100644 --- a/Assets/Tests/Misc/OtherTechTests/TestAllFieldsLevels/TestAllFieldsLevels_Config.ldtkc +++ b/Assets/Tests/Misc/OtherTechTests/TestAllFieldsLevels/TestAllFieldsLevels_Config.ldtkc @@ -14,19 +14,25 @@ { "_key": "TestAllFields", "_asset": { - "instanceID": 43784 + "fileID": 2518318380925621618, + "guid": "3222c3d6e0104884eb44c4821f66e354", + "type": 3 } }, { "_key": "NoFields", "_asset": { - "instanceID": 43824 + "fileID": 2518318380925621618, + "guid": "be7f9038a4c1bc04d9d62adff8d0cab8", + "type": 3 } }, { "_key": "TestAllNullable", "_asset": { - "instanceID": 43832 + "fileID": 2518318380925621618, + "guid": "55ee5e096e24b4542bc1968b36e6c019", + "type": 3 } } ] diff --git a/Assets/Tests/Misc/OtherTechTests/Test_file_for_API_showing_all_featuresLevels/Test_file_for_API_showing_all_featuresLevels_Config.ldtkc b/Assets/Tests/Misc/OtherTechTests/Test_file_for_API_showing_all_featuresLevels/Test_file_for_API_showing_all_featuresLevels_Config.ldtkc index f0bfad6d..ae0d4624 100644 --- a/Assets/Tests/Misc/OtherTechTests/Test_file_for_API_showing_all_featuresLevels/Test_file_for_API_showing_all_featuresLevels_Config.ldtkc +++ b/Assets/Tests/Misc/OtherTechTests/Test_file_for_API_showing_all_featuresLevels/Test_file_for_API_showing_all_featuresLevels_Config.ldtkc @@ -45,31 +45,41 @@ { "_key": "EntityFieldsTest", "_asset": { - "instanceID": 70644 + "fileID": 8271057754295682963, + "guid": "8edc4af9ae4379948ac2d95a7603e233", + "type": 3 } }, { "_key": "Labels", "_asset": { - "instanceID": 70646 + "fileID": 8271057754295682963, + "guid": "651dd273af932094fbe35791264dcfa4", + "type": 3 } }, { "_key": "RectRegion", "_asset": { - "instanceID": 70648 + "fileID": 8271057754295682963, + "guid": "e355c9bebb8a0fe458316f819cb5df56", + "type": 3 } }, { "_key": "CircleRegion", "_asset": { - "instanceID": 70650 + "fileID": 8271057754295682963, + "guid": "9a9f4260bc1dd5444a09370d4abf42f8", + "type": 3 } }, { "_key": "EntityRefTest", "_asset": { - "instanceID": 70650 + "fileID": 8271057754295682963, + "guid": "9a9f4260bc1dd5444a09370d4abf42f8", + "type": 3 } } ]