GUI Tree Node selection delay

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

Hi there,

There seems to be a delay when using either the cell_selected() or item_selected() signals with the Tree node.

My code is simple:

func _on_Tree_cell_selected():
	var SelectedItem = self.get_selected() 
	print (str(SelectedItem))

Clicking the cell rapidly produces the signal about every second rather than with every click. The same applies to item_selected().

Any idea what’s going on here? How do I make it more responsive? (Like the ‘Inspector’ tab tree in Godot itself)

Spent a lot of time trying to get it to work to no avail. Any help here is much appreciated!

:bust_in_silhouette: Reply From: AFE-GmdG

Not the signal is delayed but the output of print is.
Strings to print are cached for performance reasons so that if you put a print in for example _process() the game speed does not drop dramaticly.

Thanks for the info! While the print statement itself may be delayed, I believe something else is going on here. I added this code on:

func _on_Tree_cell_selected():
var SelectedItem = self.get_selected() 
if SelectedItem.is_collapsed():
	SelectedItem.set_collapsed(false)
	SelectedItem.deselect(0)
else:
	SelectedItem.set_collapsed(true)
	SelectedItem.deselect(0)
print (str(SelectedItem))

And the same occurs with the collapsing/uncollapsing of the cell. It is delayed and not in sync with the mouse clicks. It allows the collapsing to occur about every second, same time the string is printed, versus whenever a cell is selected/clicked on.

Appreciate the insight, hopefully this is something simple as well.

GGmd | 2021-07-04 22:27