From 184e24365f7e82d536c81b345dfe4e43c115618c Mon Sep 17 00:00:00 2001 From: veclav talica Date: Sun, 26 Nov 2023 04:21:49 +0500 Subject: [PATCH] sanity check for cell size update of tilemap that has no tiles to infer texture size from --- nodes/TileMapObject.gd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nodes/TileMapObject.gd b/nodes/TileMapObject.gd index f6f5b4b..59bc088 100644 --- a/nodes/TileMapObject.gd +++ b/nodes/TileMapObject.gd @@ -32,6 +32,8 @@ func _enter_tree() -> void: func _update_cell_size(_p_old_cell_size: Vector2, p_new_cell_size: Vector2) -> void: # We're assuming that all tile textures are of same dimensions. # todo: Diagnose mismatch by walking over all textures? + if tile_set.get_tiles_ids().size() == 0: + return var tileset_texture_size := tile_set.tile_get_texture(0).get_size() scale = p_new_cell_size / tileset_texture_size cell_size = p_new_cell_size / scale