update_dirty_quadrants() on a tilemap doesnt work. Placing or removing tiles results in huge lag

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

So basically im using a tilemap to generate a random terrain with a digging mechanic and a navigationmap for enemies to track down the player. So i thought update_dirty_quadrants() would come in handy as it SHOULD just update small changed regions (so i understand it). But instead when i place a tile it takes 1 second to update the entire map and using update_dirty_quadrants() when placing a tile doesnt do anything.

Im still pretty new to this maybe im overseeing something? I have looked up many websites and videos for a solution but couldnt find anything

:bust_in_silhouette: Reply From: smix8

That function may only update a quadrant of the TileMap but that still triggers a cascading wave of updates in the backend depending on what your TileMap has enabled.

If the TileMap uses tile baked collision it will require recalculation of an entire tree section in the physics world.

If the TileMap uses tile baked navigation it will require recalculation of all the navigation map edge connections. Since TileMap tile baked navigation is very inefficient (a single navpoly per tile) there are usually an extremely large number of navigation polygons on the navigation map and if they all need to do recalculation … that is your performance problem. In that case you can only replace the TileMap baked navigation by using something else, e.g. a NavigationRegion2D / NavigationPolygonInstance that uses a procedual navigation polygon that you create from your TileMap data.