Skip to content

Commit 1054564

Browse files
committed
followup to pr
1 parent bf953f1 commit 1054564

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Assets/LDtkUnity/Editor/Builders/LDtkBuilderLevel.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ internal sealed class LDtkBuilderLevel
2222
private LDtkComponentLayer[] _layerComponents;
2323
private MonoBehaviour[] _components;
2424

25+
private LDtkIid _layerIidComponent;
2526
private GameObject _layerGameObject;
2627
private LDtkComponentLayer _layerComponent;
2728
private LDtkComponentLayerParallax _parallax;
@@ -169,8 +170,8 @@ private void BuildFields()
169170

170171
private void AddIidComponent()
171172
{
172-
LDtkIid iid = _levelGameObject.AddComponent<LDtkIid>();
173-
iid.SetIid(_level);
173+
_iidComponent = _levelGameObject.AddComponent<LDtkIid>();
174+
_iidComponent.SetIid(_level);
174175
}
175176

176177
private GameObject CreateLevelGameObject()
@@ -244,7 +245,6 @@ private void CreateLevelComponent()
244245

245246
private void PopulateLevelComponent()
246247
{
247-
_iidComponent = _levelGameObject.GetComponent<LDtkIid>();
248248
_levelComponent.OnImport(_level, _lvlFile, _layerComponents, _fieldsComponent, _worldComponent, _iidComponent, _project.PixelsPerUnit);
249249
}
250250

@@ -292,8 +292,8 @@ void TryBuildLayerGameObject()
292292
_parallax = _layerGameObject.AddComponent<LDtkComponentLayerParallax>();
293293
}
294294

295-
_iidComponent = _layerGameObject.AddComponent<LDtkIid>();
296-
_iidComponent.SetIid(layer);
295+
_layerIidComponent = _layerGameObject.AddComponent<LDtkIid>();
296+
_layerIidComponent.SetIid(layer);
297297

298298
builtLayer = true;
299299
}
@@ -343,7 +343,7 @@ void TryPopulateLayerComponent(ref bool populated)
343343
}
344344

345345
//now that everything is gathered, do the special OnImport and populate that component
346-
_layerComponent.OnImport(_importer.DefinitionObjects, layer, _levelComponent, _iidComponent, entities, _layerIntGrid, _layerTiles, layerScale);
346+
_layerComponent.OnImport(_importer.DefinitionObjects, layer, _levelComponent, _layerIidComponent, entities, _layerIntGrid, _layerTiles, layerScale);
347347
if (_project.UseParallax)
348348
{
349349
Vector2 halfLvlSize = (Vector2)_level.UnityPxSize / _project.PixelsPerUnit * 0.5f;

0 commit comments

Comments
 (0)