Skip to content

Commit ffeb4ef

Browse files
committed
fix: Changed some fields so they are no longer static for more stable parallel import process
1 parent f73a03a commit ffeb4ef

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

Assets/LDtkUnity/Editor/ScriptedImporter/LDtkLevelImporter.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ internal sealed class LDtkLevelImporter : LDtkJsonImporter<LDtkLevelFile>
1818
{
1919
//statically reset this upon the editor application delay call so that we only need to deserialize json data once
2020
private static readonly Dictionary<LDtkProjectImporter, LdtkJson> Jsons = new Dictionary<LDtkProjectImporter, LdtkJson>();
21-
private static Texture2D _icon;
2221

2322
private LDtkProjectImporter _projectImporter;
2423
private LdtkJson _projectJson;
@@ -66,11 +65,6 @@ protected override void Import()
6665
return;
6766
}
6867

69-
if (_icon == null)
70-
{
71-
_icon = LDtkIconUtility.LoadLevelFileIcon();
72-
}
73-
7468
//instead of grabbing the level from the project that built the level in that hierarchy, build the level from this json file directly to help individualize level building to only what's changed
7569
//that being said, the level importer still has important dependencies to the project importer like tile assets, entities, and any other artifacts.
7670

@@ -150,7 +144,7 @@ private void BuildLevel()
150144

151145
assetProcess.Process();
152146

153-
ImportContext.AddObjectToAsset("levelRoot", levelRoot, _icon);
147+
ImportContext.AddObjectToAsset("levelRoot", levelRoot, LDtkIconUtility.LoadLevelFileIcon());
154148
ImportContext.SetMainObject(levelRoot);
155149
}
156150

Assets/LDtkUnity/Editor/ScriptedImporter/LDtkTilesetImporter_Artifacts.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ Tile.ColliderType GetColliderTypeForSprite(Sprite spr)
182182
}
183183
return Tile.ColliderType.Sprite;
184184
}
185-
private static Vector2 GridCheck1 = new Vector2(-0.5f, -0.5f);
186-
private static Vector2 GridCheck2 = new Vector2(-0.5f, 0.5f);
187-
private static Vector2 GridCheck3 = new Vector2(0.5f, 0.5f);
188-
private static Vector2 GridCheck4 = new Vector2(0.5f, -0.5f);
185+
private static readonly Vector2 GridCheck1 = new Vector2(-0.5f, -0.5f);
186+
private static readonly Vector2 GridCheck2 = new Vector2(-0.5f, 0.5f);
187+
private static readonly Vector2 GridCheck3 = new Vector2(0.5f, 0.5f);
188+
private static readonly Vector2 GridCheck4 = new Vector2(0.5f, -0.5f);
189189
public static bool IsShapeSetForGrid(List<Vector2> shape)
190190
{
191191
return shape.Count == 4 &&

0 commit comments

Comments
 (0)