Open Atlowell opened 8 months ago
This also seems to happen if you add collision polygons to a TileMap during runtime.
The baking just reads the TileMap used cells and cell tile data.
So this is a matter of the TileMap / TileSet not returning the expected.
EDIT Looks like this runtime tile data update is added to a special cache only used and forwarded to server updates.
The TileMap getters do not consider this runtime cache so they return the original tile state without it.
This obviously makes the parsing and navmesh baking unable to account for it when not even the TileMap own getters do it.
Perhaps then the issue should be re-categorized as a TileMap issue.
This is unfortunately not as simple as just returning the runtime_tile_data_cache value if it is available. It seems that this cache is wiped every time _internal_update() is called, and a new copy of tile data is created from the TileSetAtlasSource every time use_tile_data_runtime_update returns true.
A solution to this would thus involve the following:
Some sample code for 2 follows, though I'm not sure how to accommodate for the p_use_proxies parameter, since that seems to be specific to TileSet.
if (E && E->value.runtime_tile_data_cache) {
return E->value.runtime_tile_data_cache;
} else {
// existing code gets put in this else function
}
Tested versions
4.2.1.stable
System information
Windows 10
Issue description
If you overwrite a tilemaps's navigation data, for example using the _tile_data_runtime_update() function, you can remove navigation from a tilemap tile. This works fine when using the Tilemap navigation. However, when you attempt to use the NavigationRegion2D (linked to the tilemap) and programmatically bake the navigation polygon using bake_navigation_polygon(), these changes are not accounted for.
Steps to reproduce
Minimal reproduction project (MRP)
Test Navigation.zip