This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi there,

There seems to be a delay when using either the cellselected() or itemselected() 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!

Godot version 3.3.stable.official
in Engine by (53 points)

1 Answer

0 votes

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.

by (39 points)

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.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.