Help Needed Importing LDtk Data to Godot

Godot Version

4.7.1

Question

I could use your help to get up to speed with LDtk and Godot. I have tried, without success, to import a map I made by following instructions in a YouTube course called "LDtk Course," but I’m stuck trying to import the data into Godot using Gleeson’s LDtk importer. Lots of errors are generated during the import, and I can find nothing usable in the results.

If someone is willing to help, I could share my desktop using Gmail Meet so he could see what’s happening on my end. I hope someone can tell me what I might be doing wrong and what to do to fix my problem.

The text below is the output from one import attempt. FWIW, all of the paths mentioned in the output are correct and refer to existing files.

Godot Engine v4.7.1.stable.steam (c) 2007-present Juan Linietsky, Ariel Manzur & Godot Contributors.
  WARNING: editor/editor_node.cpp:4464 - Addon 'res://addons/amano-ldtk-importer-main/addons/amano-ldtk-importer/plugin.cfg' failed to load. No directory found. Removing from enabled plugins.
█ Godot-LDtk-Importer █ 2.0.1 | @gleeson.dev | View on Github
  ERROR: Failed loading resource: res://LDtk/LDtkTreasureHunt.ldtk.
[LDTK] Start Import: 'res://LDtk/LDtkTreasureHunt.ldtk'
• File parsed 	(1ms)
• LDTK VERSION (1.5.3) OK ✔
  ERROR: res://addons/ldtk-importer/src/tileset.gd:319 - Unable to iterate on object of type 'Nil'.
• Definitions Created 	(0ms)
█ Tilesets
	• Created new TileSet: "tileset_32px" 
  ERROR: Resource file not found:  (expected type: unknown)
  ERROR: Failed loading resource: res://LDtk/Assets/Treasure Hunters/Palm Tree Island/Sprites/Terrain/Terrain (32x32).png.
  ERROR: core/variant/variant_utility.cpp:1023 - Cannot access source texture: res://LDtk/Assets/Treasure Hunters/Palm Tree Island/Sprites/Terrain/Terrain (32x32).png. Please include this file in the Godot project.
  ERROR: Resource file not found:  (expected type: unknown)
  ERROR: Failed loading resource: res://LDtk/Assets/Treasure Hunters/Captain Clown Nose/Sprites/Captain Clown Nose/Captain Clown Nose without Sword/01-Idle/Idle 01.png.
  ERROR: core/variant/variant_utility.cpp:1023 - Cannot access source texture: res://LDtk/Assets/Treasure Hunters/Captain Clown Nose/Sprites/Captain Clown Nose/Captain Clown Nose without Sword/01-Idle/Idle 01.png. Please include this file in the Godot project.
• No texture defined for tileset 'Internal_Icons' ✘
  ERROR: core/variant/variant_utility.cpp:1023 - Tileset Definition 'Internal_Icons' has no source texture. Please fix this in your LDtk project file.
	• Tilesets Created 	(2ms)
	• Saving Tilesets: ["tileset_32px"] 
	• Tilesets Saved 	(0ms)
█ Levels
	█ Level_0
  ERROR: Resource file not found:  (expected type: unknown)
  ERROR: Failed loading resource: res://LDtk/Assets/Treasure Hunters/Palm Tree Island/Sprites/Background/BG Image.png.
  ERROR: core/variant/variant_utility.cpp:1023 - TileSetAtlasSource missing
		• Created Layers: [&"Ground", &"Triggers"] 
		• Built Level 	(2ms)
	█ Level_1
  ERROR: Resource file not found:  (expected type: unknown)
  ERROR: Failed loading resource: res://LDtk/Assets/Treasure Hunters/Palm Tree Island/Sprites/Background/BG Image.png.
  ERROR: core/variant/variant_utility.cpp:1023 - TileSetAtlasSource missing
		• Created Layers: [&"Ground", &"Triggers"] 
		• Built Level 	(1ms)
	• Built 2 Levels 	(3ms)
█ Save Levels
	• No references to resolve 
	• Saving Levels: [&"Level_0", &"Level_1"] 
	• 2 Levels Saved 	(9ms)
█ Save World
	• World Created 	(0ms)
	• Saving World 'res://.godot/imported/LDtkTreasureHunt.ldtk-f095247fc85c0510f31abb771d513c68' 
	• World Saved 	(4ms)
█ Results
• Completed. 	(22ms)
• Performance Results:
  save (13ms)
  load (1ms)
  general (3ms)
  tiles (2ms)
  post-import (0ms) 
[LDTK] Finished Import. (Total Time: 19ms)
  ERROR: editor/editor_node.cpp:4985 - Parameter "new_scene" is null.

Well, the very first lines of your log say that the add-on didn’t load.

WARNING: editor/editor_node.cpp:4464 - Addon 'res://addons/amano-ldtk-importer-main/addons/amano-ldtk-importer/plugin.cfg' failed to load. No directory found. Removing from enabled plugins.

Perhaps there are too many folders included.

Yes, the first line is with reference to an addon that I removed. Another addon was loaded up. That’s the one that generated all of the error messages.

If this applies to a different add-on, then there’s a bug in it.

ERROR: res://addons/ldtk-importer/src/tileset.gd:319 - Unable to iterate on object of type 'Nil'.

I think it’s best to ask the developer about it. Or check for yourself what’s in tileset.gd on line 319.

I think that’s possible, but Andrew Gleeson’s LDtk Importer 2.0.1 has been hailed as the penultimate LDtk importer for Godot. This version has been working for other users since it was created September 19, 2024 at least for previous versions of Godot.

I would really like to hear from someone who is familiar with LDtk and the Gleeson importer to see if they can help. Perhaps there is a setting in LDtk that I missed, or a step that I’ve left out during the import. Someone with experience could give a better answer to my query.

I appreciate your effort to help.

Tomcat, your comment about line 319 helped me get the import working. That line was the start of a for loop iterating a dictionary of layer instances. For some reason, sometimes there are no instances, and instead of an empty dictionary, the object is just null.

I added a condition to skip the loop if the object was null, and that cleared most of the errors in the output. After cleaning up a few image paths in the LDtk file, I was able to get the import to run without error.

Thanks for your help!