Hi, I'm using the TextEdit node and tried to trigger the compiler to compile my custom file after a second while _on_text_changed signal stop emit. Here is my code, I found it prints out many times of "time out" instead of one. I feel not confident about it, could someone give me some advice?
var _timer: Timer = null
var _on_counting : bool
func _on_text_changed():
if !_on_counting:
_timer = Timer.new()
_timer.wait_time = 2
_timer.one_shot = true
self.add_child(_timer)
_timer.start()
_on_counting = true
elif _on_counting:
_timer.stop()
_timer.start(2)
yield(_timer, "timeout")
_timer.queue_free()
_on_counting = false
print("time out.")
#compiler start working...