Tilemap set_cell() doesn't work with scenes collection source

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Belal

Tilmap’s set_cell() function doesn’t do anything when called with the id of a scenes collection source. I have only one Layer, a sences collection source with an id of 2 and a tile id of 2. The documentation says the argument atlas_coords for a scenes collection must always be Vector2i(0,0). So calling:set_cell(0, Vector2i(0,0), 2, Vector2i(0,0)) should place an instance of my scene at (0,0), but it doesn’t. I can manually place instances of my scene using this tilemap, no problem. Calling this function on an atlas_source works. Is this a bug ?

1 Like
:bust_in_silhouette: Reply From: vittorio_61

late is better than never so
all you need is 5th param of set_cell

set_cell(0, Vector2i(0,0), 2, Vector2i(0,0), 1)

which should be equal to ID of your scene collection tile from Tilemap

6 Likes

Very thanks

Wow I’ve been scouring the internet to figure out why this wasn’t working and this is the answer. It’s not clear from the docs that you need to do this because the 5th param is called “alternative tile”.