-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
If a resource is used as a key in a dictionary, it will be replaced by null when saving with ResourceSaver to a .tres file #57506
Comments
If this issue is available, then I would like to attempt this as a first contribution. |
Feel free to look into fixing this 🙂 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Anaxan Please don't derail other issues that are unrelated to this particular bug. |
I apoligize for any offense I've caused. That wasn't my intention. |
I just found out this bug is also present on Godot 3.4.2 stable, can be reproduced with the same project (just remove the |
As far as I was able to gather the issue, the |
Hi everyone, I have a PR that solved this problem. see #64812 :) |
By the way, I came across this issue because of a bug of |
I get the same issue on 4.2.2.stable, i used the my_data.tres as key of my dictionary and the references where null. I have changed keys to my_data.id and now it's working. Another ismular issue : https://forum.godotengine.org/t/resources-being-set-to-null-in-game/45678 |
Godot version
4.0.alpha1
System information
Windows 10
Issue description
If you have a custom resource with exported dictionary in it (let's call it
ResB
), and you use another custom resource as a key on that dictionary (ResA
), then try to save it in.tres
format, the resource that was used as a dictionary key will not be saved (replaced by anull
) and following message will be printed to console:I also found that this error only happens when you try to save to a
.tres
file. When I tried to save same resource to a binary.res
everything worked as expected with resource being saved.Also found that if you use that same resource (
ResA
) for more than as a dictionary key (say, in an exported variable) in the resource being saved (ResB
) then the bug does not happen either.Steps to reproduce
ResA
andResB
)ResB
has an exported dictionary which uses instances ofResA
as keys.ResB
that uses an instance ofResA
as a key.ResB
to a.tres
file usingResourceSaver.save("res://data.tres", ResBInstance)
Minimal reproduction project
ResourcesTest.zip
Simply run it.
res://data.tres
is the buggy output file,res://data.res
is the same resource but in binary format (and also no bug)The text was updated successfully, but these errors were encountered: