Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logic for showing tilemap debug collision #49075

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/classes/TileMap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
The light mask assigned to all light occluders in the TileMap. The TileSet's light occluders will cast shadows only from Light2D(s) that have the same light mask(s).
</member>
<member name="show_collision" type="bool" setter="set_show_collision" getter="is_show_collision_enabled" default="false">
If [code]true[/code], collision shapes are shown in the editor and at run-time. Requires [b]Visible Collision Shapes[/b] to be enabled in the [b]Debug[/b] menu for collision shapes to be visible at run-time.
If [code]true[/code], collision shapes are visible in the editor. Doesn't affect collision shapes visibility at runtime. To show collision shapes at runtime, enable [b]Visible Collision Shapes[/b] in the [b]Debug[/b] menu instead.
</member>
<member name="tile_set" type="TileSet" setter="set_tileset" getter="get_tileset">
The assigned [TileSet].
Expand Down
13 changes: 10 additions & 3 deletions scene/2d/tile_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,17 @@ void TileMap::update_dirty_quadrants() {
Color debug_collision_color;
Color debug_navigation_color;

bool debug_shapes = show_collision && (Engine::get_singleton()->is_editor_hint() || (st && st->is_debugging_collisions_hint()));
bool debug_shapes = false;
if (st) {
if (Engine::get_singleton()->is_editor_hint()) {
debug_shapes = show_collision;
} else {
debug_shapes = st->is_debugging_collisions_hint();
}

if (debug_shapes) {
debug_collision_color = st->get_debug_collisions_color();
if (debug_shapes) {
debug_collision_color = st->get_debug_collisions_color();
}
}

bool debug_navigation = st && st->is_debugging_navigation_hint();
Expand Down