Godot Version
4.3
Question
I have the following code that has worked for months which suddenly broke for unknown reasons. So basically I have the following function:
func load_deck(deck_instance : C_UpgradeDeck, deck_res_path : String):
var deck_resource : R_UpgradeDeck = load(deck_res_path)
deck_instance.resource = deck_resource
for upgrade : R_Upgrade in deck_resource.upgrades:
if upgrade is R_Upgrade:
deck_instance.upgrades.push_back(C_UpgradeEntry.create(deck_instance, upgrade))
elif upgrade == null:
printerr("R_Upgrade is null: ", upgrade.resource_path)
else:
printerr("R_Upgrade is not considered an R_Upgrade: ", upgrade.resource_path)
The “if upgrade is R_Upgrade” line is here to demonstrate how the code breaks- it should be impossible for upgrade to be anything other than an upgrade, yet that’s exactly what is happening here and prints this SOME OF THE TIME:
Check out my R_UpgradeDeck, which shows the type and example of the deck_resource.upgrades I’m looping through:
(Note that its an Array[R_Upgrade] so how could any not be an R_Upgrade?)
This function works with other decks/arrays (you can see in the errors above that the first two R_Upgrade don’t trip the error too.
No noticeable difference in the inspector between one that works and one that breaks:
The only difference I managed to find was that at runtime, the ones that work will populate the inspector for the upgrade:
But the ones that break only look like this:

The script is still recognized as an R_Upgrade though…
Is this corruption? If so, any ways to fix? My source control doesn’t register any differences between the broken R_Upgrades and I have lots of work I don’t want to revert
Any ideas is much appreciated. Thanks!