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

The function itself I don't think is of relevance, but I'll put it here anyway:

func player_toggle_mode():
if GV.curr_player.idle and GV.curr_player.is_on_floor():
    if !GV.curr_player.split(): 

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 _physics_process or _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_down or 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.

in Engine by (276 points)

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!

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

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:
Maybe try download version 3.2 or lower and see if the same issue occurs?

Please log in or register to answer this question.

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.