This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

hey guys, is it possible to delete a single tile from a tilemap, directly from code ?
there is no obvious function that could do that in the TileMap class.
How about adding a single tile to an existing tilemap, also directly from code ?

in Engine by (530 points)
edited by

2 Answers

+1 vote
Best answer

d'oh... tilemap.setcell(int x, int y, int tile) seems to do both..creating a new tile whenint tile is a valid tile number, or deleting a tile when int tile = -1

by (530 points)

can't believe I actually created an invisible tile with no properties, to replace the visible one which had collisions and stuff..

0 votes

Try in 2 options

1.tilemap.tileset.remove_tile(id)

2.tilemap.set_cellv(position, -1)

by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.