You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you attempt to use the select and move tools in the GridMap while a reference to a now non-existent mesh library item is in the GridMap, it will crash with the following:
Also, as a work around for anyone who runs into this issue - if you drop the below script into your project, you can add a GridMapCleaner node into your scene, assign the problematic GridMap to it and click the button in the inspector pane to remove reference to any mesh library items that are no longer valid (with the currently assigned mesh library):
@toolclass_nameGridMapCleanerextendsNode
@export_tool_button("Remove Invalid Items", "Callable") varremove_invalid_items_action: Callable=remove_invalid_items@exportvargrid_map: GridMapfuncremove_invalid_items() ->void:
ifnotgrid_map:
print("GridMapCleaner: GridMap has not been set, aborting.")
returnvarmesh_library: MeshLibrary=grid_map.mesh_libraryvarused_cells: Array[Vector3i] =grid_map.get_used_cells()
foriinrange(used_cells.size()):
varcell: Vector3i=used_cells[i]
varitem_index: int=grid_map.get_cell_item(cell)
varmesh: Mesh=mesh_library.get_item_mesh(item_index)
ifnotmesh:
print("GridMapCleaner: Removing invalid mesh ID (", item_index, ") at ", cell)
grid_map.set_cell_item(cell, GridMap.INVALID_CELL_ITEM)
print("GridMapCleaner: Finished removing invalid items.")
Tested versions
System information
Godot v4.4.1.stable - Ubuntu 25.04 25.04 on X11 - X11 display driver, Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Ti (nvidia; 570.133.07) - 12th Gen Intel(R) Core(TM) i9-12900F (24 threads)
Issue description
If you attempt to use the select and move tools in the GridMap while a reference to a now non-existent mesh library item is in the GridMap, it will crash with the following:
Steps to reproduce
In the MRP, open
gridmap_scene.tscn
, select the GridMap node and then use the selection tool (Q) to select all the visible tiles like this:With these items selected, use the move tool (X) and the tiles will be able to be moved without issue.
Now, to cause the crash, change the mesh library assigned to the GridMap node to
missing_tile.meshlib
and see the red tiles (Tile2) disappear:With the new mesh library assigned, repeat the previously steps to select and move the tiles, and the crash will occur.
Minimal reproduction project (MRP)
invalid-gridmap-items-crash.zip
The text was updated successfully, but these errors were encountered: