Skip to content

Duplicating TileMapLayers with scene tiles causes them to double on the copy #101374

@flip-rossi

Description

@flip-rossi

Tested versions

  • Reproducible in: v4.3.stable.mono.arch_linux

System information

Godot v4.3.stable.mono unknown - Arch Linux #1 SMP PREEMPT_DYNAMIC Thu, 02 Jan 2025 22:52:26 +0000 - Wayland - GLES3 (Compatibility) - AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.59, 6.12.8-arch1-1) - AMD Ryzen 7 7840HS with Radeon 780M Graphics (16 Threads)

Issue description

Whenever a TileMapLayer is duplicated with the Node.duplicate(flags) method, all its children are, as expected, also duplicated. However, as any scene tiles are instantiated as children, their instances are also duplicated, then, when the duplicate TileMapLayer does its first update, it instantiates all its tile scenes. So you end up with, for each scene tile, an instance that came from the duplicate(), and an instance that came from the new tilemap itself.

Steps to reproduce

  1. Create a TileMapLayer node with scene tiles;
  2. Access it from a script and call its duplicate() method.

Minimal reproduction project (MRP)

double-duplicate-tilemap.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions