Inspector not showing certain new classes with "fast load" function

Godot Version

4.7.1.stable

Question

Hello! I’m having a weird issue that I haven’t been able to find info about. Perhaps it’s a bug of Godot, but I don’t really know so I came to ask if anybody perchance would know about it.

I’m using @export with some new classes that I’ve made and it’s been working fine. I have these two examples, where the first works okay, but the second one not:

  1. Fast load working good
@export var team_data: Array[EnemyRecruitResource] = []
class_name EnemyRecruitResource extends Resource

@export var level: int = -1
@export var nickname: String = ""
@export var training_stats: Array[int] = []
@export var attacks: Array[AttackResource] = []

@export var data: RecruitResource = null

It’s an array of a special class I created and I can use the fast load function without any issue.

  1. Fast load not working
@export var possible_recruits: Array[RecruitResource] = []
class_name RecruitResource extends Resource

@export var id: int = -1
@export var specie: String = ""
@export var type: Core.Type = Core.Type.ERROR

@export_category("Stats")
@export var hp: int = -1
@export var attack: int = -1
@export var defense: int = -1
@export var special_attack: int = -1
@export var special_defense: int = -1
@export var speed: int = -1

@export_category("Visual")
@export var icon: Texture2D = null
@export var sprite_front: Texture2D = null
@export var sprite_back: Texture2D = null

But for this array in specific the functionality doesn’t work, even though I know for certain that I have resources created.

If I make a single @export like this:

@export var recruit: RecruitResource

The issue is still there. It doesn’t fast load any RecruitResource, so it must be something wrong with the class. I’ve restarted the project in case it was some bad cache shenanigans, but it’s still there.

If you have any advice, please tell me.

It’s not a critical bug, but it’s annoying and I’d like to know if I implemented something wrong or if it’s just a bug.

UPDATE

After doing some testing, I’ve been able to do a workaround, but I still don’t know the source of the issue.

Initially I thought it was all because of having this line inside RecruitResource:

@export var type: Core.Type = Core.Type.ERROR

Because this specific type/enum is declared in a singleton called Core. In all lights it seems a sketchy implementation, but the inspector works just fine and I’ve been assigning and using data without any issue up until now. I programmed it this way because attacks also have types and doing it like this there’s only 1 source of truth which both Resources can pull data from.

The workaround was creating the new RecruitResource again and now the fast load function works.

I don’t know if it broke when I change data inside the RecruitResource and it had to be created again or if it’s because I use a data type from a Singleton, or a combination of both. But in any case, the issue seems to come from any of those lines. If anyone wants to investigate a little further, could be great.