Inconsistent interaction between Area2D and TileMap

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

Hi all,

I am trying to make an Area2D react to the collision with a TileMap by changing direction. To do this I emit a signal from the Area2D like:

func _on_Area2D_body_entered(body):
print(body.get_name())
if body.get_name() == "TileMap":
	emit_signal("tile_touched")

But I observe inconsistent behaviour, as sometimes the Area2D detects the tiles and sometimes not. This is eveidenced as sometimes it prints the name TileMap and changes direction and sometimes nothing is printed and it goes through the tiles.

Is this a bug or am I using it incorrectly?