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

Script/path is not saved when saving a GDScript object as a sub resource with ResourceSaver #952

Open
paczek654321 opened this issue Jan 27, 2025 · 3 comments
Labels
bug confirmed topic:dotnet tracked:godot Issue already tracker on the godot issue tracker

Comments

@paczek654321
Copy link

Tested versions

v4.3.stable.official [a06b0a0]

System information

Redot v4.3.stable - Arch Linux #1 ZEN SMP PREEMPT_DYNAMIC Sat, 18 Jan 2025 02:26:52 +0000 - X11 - Vulkan (Forward+) - dedicated AMD Radeon RX 7700 XT (RADV NAVI32) - AMD Ryzen 7 5700X 8-Core Processor (16 Threads)

Issue description

If a resource that has export variables with custom class types those properties are not loaded properly with load() (Previously saved with ResourceSaver). Seems to be related to godotengine/godot#32856

Steps to reproduce

  • Make 2 custom resources
  • Have one of them have a variable with the other one as its type
  • Save the first resource
  • Load it back
  • See that the custom class property didn't load correctly

Minimal reproduction project (MRP)

resourcesaverbugreproduction.zip

@paczek654321
Copy link
Author

The relevant code appears to be in this file.

@paczek654321
Copy link
Author

paczek654321 commented Jan 28, 2025

Turns out this only affects classes created with the class keyword and classes created with class_name work as expected.

@paczek654321
Copy link
Author

The issue seems to be that when a class is declared with class_name, saving it also saves an external resource containing the script path
example: [ext_resource type="Script" path="res://TestType.gd" id="1_ryveg"]
But when its declared with class a sub resource is created containing no additional info (like the source code)
example: [sub_resource type="GDScript" id="GDScript_qs7av"]
So the solution to this issue would be to include more data in the GDScript sub resource I think.

@Spartan322 Spartan322 added bug confirmed topic:dotnet tracked:godot Issue already tracker on the godot issue tracker labels Jan 29, 2025
@paczek654321 paczek654321 changed the title ResourceSaver.load() not working when the resource has custom class properties Script/path is not saved when saving a GDScript object as a sub resource with ResourceSaver Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed topic:dotnet tracked:godot Issue already tracker on the godot issue tracker
Projects
Status: Open
Development

No branches or pull requests

2 participants