Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Mrpaolosarino |
I have a double tap logic
var clicked = false
func double_input(input):
if Input.is_action_just_released(input):
clicked = true
yield(get_tree().create_timer(0.5),"timeout")
cliked = false
if clicked == true:
if Input.is_action_pressed(input):
return true
It works fine just as intended but if I print it out, the log will be like this:
null
null
null
null
[GDScriptFunctionState:1305]
true
null
I don’t know why but I deduce that it prints the yield in my function, anyone knows how to deal with this?
EDIT:
I’ve got a workaround. I created a ‘match’ system that filters if it is object,bool or null and it’s working.
InputEventMouseButton already has a doubleclick
property.
Anyway according to the docs
Calling
yield()
will immediately return from the current function, with the current frozen state of the same function as the return value.
So this is intended behavior. You probably shouldn’t be using yield()
in this situation.
exuin | 2021-04-21 05:18