CustomResource not able to save another CustomResource that also has it saved as a variable.

Godot Version

4.2.2

Question

So I am trying to have 2 different Custom Resources save references of each other, where both have access to each other. When I try to save when both have each other to save, it saves as null and gives me this error:
“Resource was not pre cached for the resource section, bug?”
When I changed everything so it only has it saved on one of them, the other not having it saved as anything (which I really need…) it works, no error but one doesn’t have the reference of the other.

Custom Resource 1 saves Custom Resource 2 in a var.

Custom Resource 2 saves Custom Resource 1 in a var.

I have tried many different things I have found around the error in the forums, nothing worked. After a few hours, I have pretty much come to the conclusion that the issue isn’t saving either custom resource, but saving them when they both have references to each other. I have no clue how this would be the case but it seems to be.

Worst case I will have to iterate over an array of resources to see what has the other resource, every time it needs to accessed from the other resource. But this is not a route I hope I have to go with, even if its easy to add.

The save controller didn’t change, and that script has remained the same, everything works properly apart from the variables saving each other.

What I have tried:

  • I updated the Godot version from 4.2.1 to 4.2.2, didn’t fix it.

  • I tried changing to .res saves instead of .tres and it also didn’t work, it just didn’t show the error when saving. Someone said it might fix it.

  • I tried the different SaverFlags

  • I tried using weakref() to store it, but it doesn’t seem to store anything, and just equals null, I’m still trying to figure it out but that is currently what I am trying as I have learned it is what you should use to cross reference. This also just doesn’t seem to be able to be saved in an export var.