-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Resource.duplicate(true) also duplicates the script #58031
Labels
Comments
big oof on this. i was running in circles trying to find the source. |
Seems to be fixed in Godot 4.0. |
This was referenced Mar 6, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Godot version
3.4.2 and 4.0 alpha
System information
Arch Linux
Issue description
Calling
Resource.duplicate(true)
to make a deep copy of a resource will also duplicate the assigned script. This bug exists in both Godot 3 and 4.However, in Godot 3 it was possible to override the
duplicate
function to manually handle copying. In Godot 4.0 overriding does not work.Technically, it behaves correctly as it is supposed to make a deep copy, but I don't think it should include the script.
Steps to reproduce
The reproduction project contains a custom resource
CustomResource
and a tool nodeResourceDuplicator
that instantiates oneCustomResource
and then duplicates it in_ready
.main.tscn
Immediately after, Godot will log an error of another class hiding
CustomResource
.This happens because Godot also copies the script. Upon saving you can also see the duplicated script in
main.tscn
.Minimal reproduction project
resource_script_duplication_4.0.zip
The text was updated successfully, but these errors were encountered: