Import map during runtime? (Godot)

Is there a way to import a map via script during runtime with the Godot importer?

I’m not sure what exactly you’re trying to achieve, but if you’re using this Godot importer you may be interested to try this new Tiled exporter by @Mihail_Ilinov instead:

With this Tiled extension, once you export your map it will be immediately available in Godot without needing an additional importer.

Note that it is uses some new script API so you’ll need to download the latest snapshot version instead of Tiled 1.3.3 to use this extension.

Just to add that a Tiledmap exported from Tiled is a Scene with a Tilemap node in Godot.
So if you want to load it in your game runtime, you should just make an instance via:

# Load a tilemap
var exported_map_resource = load("res://path/to/exported_map.tscn)
var exported_map= exported_map_resource.instance()
root.add_child(exported_map)

Thank you!

1 Like