|Topic was automatically imported from the old Question2Answer platform.
The function itself I don’t think is of relevance, but I’ll put it here anyway:
if GV.curr_player.idle and GV.curr_player.is_on_floor():
GV.curr is a KinematicBody2D with a split and merge function that involves replacing nodes with other nodes. The weird thing is this script works fine when called in
_process using an
Input.is_action_just_pressed key. It even works with my GUI button if I call:
if $Pathtobutton.pressed: player_toggle_mode()
If I directly connect the
button_up, the function misbehaves (explaining how it misbehaves would be very tricky, basically the function calls for new nodes to be introduced and when called this way their positions are wrong).
I would guess it has something to do with the stage at with Input from Control node buttons are taken, but I’m really stumped.
If you try
$Button.emit_signal("button_down") or up in one of your
process functions, does the same issue occur? This just emulates the button press signal, so it might give you some more insight into the problem.
And this is wouldn’t change anything, but obviously you’ve tried the
pressed() signal as well? Anyway, it sounds like there’s some quite quirky behaviour that’s going on. I would recommend lots of
prints anywhere you can within the function. It might hellp narrow down whether the quirk is your own code or it’s an engine bug. Maybe try changing things and values in the function too.
Also relevant to anyone who might know the answer, what Godot version are you using? Good luck!
Yuminous | 2021-08-11 12:45
I’ve just checked, and calling
emit_signal() also works as intended. I genuinely have no idea why it is behaving this way.
edit: using 3.3.2
psear | 2021-08-11 13:12
Without being able to play with the project itself, it does sound like maybe it’s an engine bug. At this link you can download previous Godot versions: Index of /godotengine/
Maybe try download version 3.2 or lower and see if the same issue occurs?
Yuminous | 2021-08-12 10:36