(sorry for the double post, in a sleep-deprived mania I thought I had solved it, but no, I had just opened 4.2.2 instead of 4.3 by mistake.)
Godot 4.2.2 → 4.3
My project broke on updating from 4.2.2 to 4.3, and I’m not quite sure why, so I thought I’d ask here to see if I’m missing something, if there’s an obvious fix, or if I should be making a bug report.
I have a custom resource which I was planning to expand later, but right now it’s very simple, just 4 int variables. This is the entirety of the resource script:
class_name Infusion
extends Resource
@export var air: int = 0
@export var earth: int = 0
@export var fire: int = 0
@export var ice: int = 0
Another resource (CombatCard) uses this resource as an export variable, like so:
@export var infusion:= Infusion.new()
In 4.2.2, this all works as I expected. I could set specific Infusion values in the editor for testing purposes, and if I did not set an Infusion in the editor it would just make a new one with the default values.
In 4.3, running the project quickly gives me this error:
(image redacted, new users can only upload one media item per post)
Additional investigation shows that if I try to make a new Infusion from code (or possibly any custom resource, haven’t gotten to work around this to see whether anything else is broken) then the autocomplete for the custom resource looks off.
It, and all my other custom resources, do not have the little resource icon next to them (as they do in 4.2.2,) making me think Godot is not recognizing them as resources for some reason?
(image redacted, new users can only upload one media item per post)
A bit of sleuthing reveals that it still works fine in 4.3-rc1, but 4.3-rc2 onward gives me the issue. I’ve tried a few ways to fix it, including removing all instances of Infusion.new() and trying to set everything through the editor, messing around with _init(), rebooting the editor, my computer, but no luck. CombatCards in 4.3 just can’t be made to have Infusions and I don’t know why.
It would be one thing if it didn’t work in 4.2.2 either, I’d just refactor it (and may do so anyway, there’s no real reason for something this simple to be its own resource rather than just member variables of the first resource.) The fact that it used to work and no longer does gives me pause, however, and makes me concerned that I’m misunderstanding something fundamental about custom resources, or export variables, or constructors, or etc. I’m also concerned that if it’s a bug, I’m just going to have future problems once I implement a simple workaround.
I haven’t been able to create a minimal reproducible project, which makes me think maybe it has something to do with loading or preloading of resources/scenes? Maybe?
My attempt at a MRP does replicate the “no resource icon in autocomplete” thing, but it works, so maybe that’s just a 4.3 change.
(image redacted, new users can only upload one media item per post)
If you know what I’m doing wrong, let me know. If you have an idea on how to narrow down what’s going wrong or generate a minimal reproducible project, even better! I’m open to suggestions.