Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Jatoxo |
I have a TileMap in my Scene which I store in a variable and then remove from the scene tree with “remove_child”.
I then create a Thread to fill the tilemap with a large number of cells to create my world.
When the thread finishes, I add the TileMap back into the scene with “add_child”, but this causes the game to freeze for several seconds.
Is there any way to avoid this lag but still be able to use a Thread to fill the TileMap? Since you can’t access the scene tree from a Thread I don’t see how…
Can you try calling the add_child
method inside a call_deferred
method?
nightrobin | 2021-03-05 15:18
It already was inside of a call_deferred method, called by the thread at the end when it is done adding tiles
Jatoxo | 2021-03-05 21:35