godotengine / godotengine/godot
[C#] Signals created with `GodotObject.Connect()` aren't on the duplicated node when using `Node.Duplicate()`
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Reproducible in: v4.3.stable.mono.official [77dcf97d8], v4.1.1.stable.mono.official [bd6af8e0e], v4.4.dev5.mono.official [9e6098432]
### System information
Godot v4.3.stable.mono - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce GTX 1070 (NVIDIA; 32.0.15.6603) - Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 Threads)
### Issue description
I'm using GodotObject.Connect() to connect a signal to a button (Including "ConnectFlags.Persist"), then using Node.Duplicate() to create a duplicate, however the duplicate doesn't have the signal connected.
### Steps to reproduce
```cs
[Export] VBoxContainer container;
[Export] Button button;
public override void _Ready()
{
button.Connect("pressed", Callable.From(delegate { GD.Print("pressed"); }), (uint)ConnectFlags.Persist);
Node newButton = button.Duplicate();
container.AddChild(newButton);
}
```
When I run the project, pressing the original button will print "pressed" to the console, and the duplicated button does nothing.
### Minimal reproduction project (MRP)
[connect-signal-persist.zip](https://github.com/user-attachments/files/17927495/connect-signal-persist.zip)
Contributor guide
Research direction
Reproduce the behavior with the attached connect-signal-persist.zip project, starting from GodotObject.Connect(), ConnectFlags.Persist, and Node.Duplicate(). Trace how the persisted connection is handled during duplication. Done means the duplicated button retains the signal connection and responds like the original.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100