Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signals appear to be broken to some extent #85528

Open
Knight-XAura opened this issue Nov 30, 2023 · 9 comments
Open

Signals appear to be broken to some extent #85528

Knight-XAura opened this issue Nov 30, 2023 · 9 comments

Comments

@Knight-XAura
Copy link

Godot version

v4.2.rc2.official [1ba920f]

System information

Godot v4.2.rc2 - macOS 14.1.1 - GLES3 (Compatibility) - Apple M1 - Apple M1 (8 Threads)

Issue description

I've messed around a lot with signals and until now I've NEVER had anything remotely strange or buggy happen other then the occasional signal is working, just the editor not showing the symbol next to the function. BUT I started a new project starting with Godot 4.2.rc2 and I've run into crashes, signals not connecting at all, custom arguments disappearing or turning to there default value.

Crashes: This that I noticed so far is strictly in some cases where you attempt to set a dictionary or array value as an Object type and set in my case as New PackedScene. This doesn't happen too frequently

Signals not connecting/randomly disappearing: Right after pressing connect to finalize there is no icon next to node in node tree and the connection is missing from signals tab and the signal doesn't work during runtime. Other times the signals have all just randomly disappeared, every single one from a scene file I have not touched anything but the script file for it. This happens not too frequent unless you combine it with the next issue

--- When signals fail to connect I see to get something like this: Cannot connect to 'pressed': the provided callable is not valid: VBoxContainer(Main.gd)::_on_world_pressed but if I do it again the exact same thing it works, but also if I don't add an argument during signal created with Advanced it seems to work reliably. Sometimes it adds the signal function and sometimes it don't. If it does the first time it will tell me this even though when it gives me this, everything is finally working...til it randomly breaks: res://Main.gd:70 - Parse Error: Function "_on_world_pressed" has the same name as a previously declared function.

Custom Arguments: This seems to be mostly surrounding Arrays and dictionaries. When you lose data for example New PackedScene like in the crashes if you set it's Path and it doesn't work if you go back to try and reset this, you can't til you close the project (I'm pretty sure closing the scene wasn't enough if I even did this) Then you can try again. Trying to use a signal with a custom argument of Array or Dictionary pretty much always fails and if it doesn't the argument types data is null again instead of what you set it to.

All of these issues I have recordings of happening. I'll hopefully be going through those this weekend and maybe I can share if there is disbelief this is happening how I claim, since it does sound absurd lol

Also I know I tried to break these up into groups as much as possible, but as you can tell a lot of them have similar things going on or a similar situations with a slight variation has a whole other issues.

Steps to reproduce

Crashes: May happen sometimes when using Advanced Signal connections and adding a Agument of Type Array or Dictionary when it's Type is set to Object and you click New PackedScene (may happen with others, this is just what I was trying to do)

Signals not connect/randomly disappearing: This kinda just happens when connecting signals there doesn't seem to be any solid reason or way to cause it to happen. Most probable way I think I got this to fail completed was using the example for Crashes, but may need to fill in the path.

Custom Arguments: if you set Types and Values for Arrays and Dictionaries they don't stay

Minimal reproduction project

Any project very bare bones will cause this to happen. No need to provide as it takes actions being done to reproduce that providing a project itself won't show or do for you.

@StephenAversa
Copy link

I am experiencing this exact same issue with 4.2. Relaunching my project in 4.1 appears to revert the signals back to their working condition, but when in 4.2 some of the previously working signals just stop working. Not sure exactly what is causing it as I am not getting error output and many of my signals are still firing, however in relation to the post here I can at least say one of my signals that no longer works in 4.2 does interact with a dictionary object so perhaps that is related.

@akien-mga akien-mga added this to the 4.3 milestone Nov 30, 2023
@ADustyOldMuffin
Copy link

I can add to this, I have a project in 4.1 that has signals hooked up to mouse_entered and if I try the project in 4.2 the signal never fires.

# Called when the node enters the scene tree for the first time.
func _ready():
	mouse_entered.connect(on_mouse_entered)
	mouse_exited.connect(on_mouse_exit)
	pass

func on_mouse_entered():
	EventBus.card_hovered.emit(self)

The call itself is very simple, and just fires another signal.

@danny88881
Copy link
Contributor

Just upgraded my project and also getting a few "Cannot connect to '<signal_name>': the provided callable is not valid" errors.
For me, I think it was because the target method was in a parent script; possible regression in this regard.
I was also able to reliably connect to the method without arguments, but once I added arguments, the error would pop up.

@danny88881
Copy link
Contributor

danny88881 commented Dec 2, 2023

After some tracking, it seems to be the changes made in #82695 that are causing the issues, or at least the ones I'm running into. Specifically the additional "is_valid" check on line 1322.

Looks like the behavior difference between a connection without additional arguments and one with them has to do with the Callable being a CallableCustom when args are used. On the check at line 1322, for CallableCustoms it returns false since it checks if the method exists.

When called without additional arguments, from what I can see, no checks ensuring method existence are done, so it's able to run without issue.

@Gramps
Copy link

Gramps commented Jan 4, 2024

In 4.2.1, I find that the "signals fail to connect" issue reliably shows up if there is any error in my script and I am trying to add an argument to a signal. Even a previously connected signal will disconnect if an argument is added prior and any error in the script exists.

If no errors exist, then I can successfully attach signals with arguments; whether initially or edited later. It is a bit frustrating, honestly.

@WalruswareGames
Copy link

It also seems that built-in signals with arguments do not connect in 4.2
They generate the func _on_button_pressed(arg0) etc but they do not show the connection in the signal tab and do not fire

@DaloLorn
Copy link

Any hope of a fix in 4.3?

@Knight-XAura
Copy link
Author

Knight-XAura commented Mar 12, 2024 via email

@KoBeWi KoBeWi modified the milestones: 4.3, 4.4 Jul 26, 2024
@hugoburguete
Copy link

I came across a somewhat similar issue and am able to replicate it very easily. I've created a repo with a reproduction of what I'm experiencing here: https://github.com/hugoburguete/godot-4.3-signal-connect-bug

I'm not sure if this is user error but the issue I'm having is that when I attach a custom argument to a signal, I get the error Cannot connect to 'event': the provided callable is not valid. To reproduce, I:

  • Create a button
  • Connect to a signal (in the example, I used the pressed event)
  • Add an extra argument
  • Connect
Screencast.from.2024-09-17.11-35-36.webm

Godot version: v4.3.stable.mono.official [77dcf97]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests