godotengine / godotengine/godot

Unexpected scene tile recreation after calling `update_internals()`

Open
#93,076 1 comment 1 reaction 0 assignees View on GitHub
bug topic:2d
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

4.2.2.stable / 4.3.beta1

### System information

Arch Linux

### Issue description

It's documented that scene tiles may not be available when the tilemap is ready, and users can call `update_internals()` to force immediate update.

https://github.com/godotengine/godot/blob/3a11eb98181d8fa0b173a8e45ee22e2a8f23ac55/doc/classes/TileMapLayer.xml#L8-L9

Calling `update_internals()` does force create the scene tiles. But these scene tile instances seem temporary. Another deferred internal update (caused by `TileSetAtlasSource::_update_padded_texture`) will soon destroy these instances after `_ready()`.

This seems like a bug, because scene tile instances are not related to the `TileSetAtlasSource` texture update. They should not be recreated.

### Steps to reproduce

Create a TileMapLayer and draw a scene tile.

Run the MRP. Sample output:

```
Scene tiles are not created when _ready: []
Call update_internals()
Created
Now scene tiles are created: [SceneTile:]
Now exit _ready
Created
In a deferred call: [SceneTile:, @Node2D@2:]
Destroyed SceneTile:
```

### Minimal reproduction project (MRP)

[update-internals.zip](https://github.com/user-attachments/files/15802213/update-internals.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.