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

PackedScene Instantiate from Tool Script is preserving Signals when saved #86532

Closed
Jemy191 opened this issue Dec 26, 2023 · 3 comments · Fixed by #97303 · May be fixed by #100965
Closed

PackedScene Instantiate from Tool Script is preserving Signals when saved #86532

Jemy191 opened this issue Dec 26, 2023 · 3 comments · Fixed by #97303 · May be fixed by #100965

Comments

@Jemy191
Copy link

Jemy191 commented Dec 26, 2023

Tested versions

  • Reproductible in:
    v4.2.1.stable.mono.official [b09f793]
    Godot v4.1.3 stable mono
    Godot v4.1 stable mono

System information

Godot v4.2.1.stable.mono - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3060 Ti (NVIDIA; 31.0.15.4592) - Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz (20 Threads)

Issue description

I'm experiencing unusual behaviour with tool script and packed scene instantiation.
When instantiating a PackedScene that has signals connection, the signals are saved to the scene file.
The nodes themselves saved, only the signals are.

Steps to reproduce

Download TestBugSignal.zip
1: open the project in either the mono version or the normal version.
2: open the scene Node2D(C#) or Test2(GDScript)
3: wait for the 10 number to print in the console
4: open the previously opened scene file in a text editor
5: notice the 10 signal connection in the file

Minimal reproduction project (MRP)

TestBugSignal.zip
or
Create a scene that as any signal connection in it.
Create a scene that as a script that has this code:

@tool
extends Node2D

@export var test: PackedScene:
	set(value):
		test = value
		refresh()

func _ready() -> void:
	refresh()

func refresh():
	if not test:
		return

	for i in 10:
		add_child(test.instantiate())
		print(str(i))

follow Steps to reproduce

@Rindbee
Copy link
Contributor

Rindbee commented Dec 30, 2023

Similar to #48064 and #85372.

@Jemy191
Copy link
Author

Jemy191 commented Dec 31, 2023

@Rindbee yes thank it is the same bug

@rthomas-private
Copy link

rthomas-private commented May 12, 2024

I got this on v4.2.2.stable.official [15073af]
All Area2D body_entered() or body_exited() connections made through the editor using the node signals throw this error on scene load.
It happens when I reload a previously packedscene which I used to save the original scene.
Error stopped when I recreated all my Area2D connections in code using;
func _ready(): self.connect("body_entered", Callable(_on_body_entered))
and likewise for _on_body_exited
I notice it doesn't happen for area_entered, or indeed for any other signals I currently have.
hope this helps 🤷‍♂️

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