Inspect selected node in isolation

Godot Version



Is there a way to highlight the selected node in the viewport or to hide all other nodes except for the selected node and its children?

Something like “Toggle Visibility” but only for the unselected nodes?

simplest solution would be sth like this:

var highlighted_node: Node
var highlight_old_z_index: int
var highlight_rect: ColorRect

func highlight_node(node):
 highlighted_node = node
 highlight_old_z_index = highlighted_node.z_index
 highlighted_node.z_index = 1,000,000 # comma gets ignored by engine

func get_highlight_background():
 highlight_rect =
 highlight_rect.global_position = Vector2(-1000, -1000)
 highlight_rect.rect_size = Vector2(2000, 3000) # to cover 1080p Window
 highlight_rect.show_behind_parent = true
 highlight_rect.modulate = Color(0, 0, 0, 0.5) # slightly opaque black

func hide_highlight():
 highlighted_node.z_index = highlight_old_z_index

If the node you want to highlight is a type of Rect (or Label), node color in tree GREEN, then you have to set the z_index via a Node2D type parent node