Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instantiating a scene containing a TileMapDual doesn't update the tiles initially #33

Open
ivoltz opened this issue Feb 14, 2025 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@ivoltz
Copy link

ivoltz commented Feb 14, 2025

Hello, first of all thanks for the plugin, I've been using it for my project and it's been really useful!
Now I've recently updated it to v5 and got an issue when instantiating a scene containing a TileMapDual, here's the description:

Tested Version
Godot 4.3

Issue description
When instantiating a PackedScene containing a TileMapDual node with pre-existing tile data, the instance doesn't automatically update the tiles which are set to their initial state. This might be a visual-only bug, and doesn't happen when the scene is directly run from the editor with Run Current Scene. Any update to the tileset afterwards seems to fix the issue.

Image
From the example scenes, MultipleAtlases.tscn when run directly from the editor

Image
MultipleAtlases.tscn when instantiated from a PackedScene

Steps to reproduce

  1. Open the default TileMapDual-main project
  2. Add some code to instantiate another scene containing pre-existing tile data at runtime from any scene
  3. Run the project
  4. Instantiate the other scene, you will see that the pre-existing tile data isn't properly displayed

I've reproduced the issue by adding some quick code in CursorDual.gd to instantiate MultipleAtlases.tscn (which is the clearest example) from a PackedScene and got 100% repro. Unfortunately I'm not able to upload my MRP for some reason but here's the code I added:

var multiple_atlases = preload("res://examples/MultipleAtlases.tscn")

# Inside _process
if (Input.is_action_pressed("ui_focus_next")):
	var instance = multiple_atlases.instantiate()
	get_parent().queue_free()
	get_tree().root.add_child(instance)

Pressing Tab would instantiate MultipleAtlases.tscn without any tile displayed. Further updates to the tileset by adding a tile (while still running) with the cursor correctly updates the entire tileset

Hope you can help me with this issue, thanks!

@pablogila pablogila added the help wanted Extra attention is needed label Feb 17, 2025
@pablogila
Copy link
Owner

Hey there!
Thanks for sharing. This seems related to #10. I thought it should be fixed by updating the tilemapdual at _ready(), but for whatever reason this does not work. I'm not sure what could be the problem, any suggestion is really welcome.
Cheers!

@ivoltz
Copy link
Author

ivoltz commented Feb 21, 2025

Thanks for the reply, I'll try to delve deeper in the plugin code when I find the time. Maybe a delayed update could do the trick temporarily but it's definitely not viable long-term.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants