How I can fix this problem?

I’m trying to replace the tile, but I get an error

main/scripts/onClick.script:36: Instance main:/BaseContainer/House#dtt not found

This is line number 36
tile = tilemap.get_tile(“main:/BaseContainer/House#dtt”, ‘layer’, 2, 2)
I also added a screenshot of the project hierarchy
Capture

Please tell me, what am I doing wrong?

:face_with_monocle: your script (oneClick) is inside the game object “House” and the path you call in the code is misspelled :
(tile = tilemap.get_tile(“main:/BaseContainer/House#dtt”, ‘layer’, 2, 2))

Try typing: tile = tilemap.get_tile("#dtt", ‘layer’, 2, 2) :nerd_face:

ps. everything that’s inside “House” you call it “#sprite” as example.
whatever is outside of “House” you call “go#sprite” or “main/go#sprite” as example,
as long as your script (oneClick) is hosted in “House” :wink:

1 Like

Thx,
linking onclick to House was a good idea. (It was pinned to the BaseContainer in the beginning)

:face_with_monocle: it wasn’t a bad idea for oneClick to be a child of BaseContainer, just by writing the code correctly you would make it work. So the line would look like this as long as oneClick is a child of BaseContainer:
tile = tilemap.get_tile(“House#dtt”, ‘layer’, 2, 2) as example. :wink:

ps. happy to help. :blush:

1 Like