The type of Resource is not resolved correctly

Godot Version

v4.2.1.stable.mono.official [b09f793f5]

Question

Why my code is not recognizing the correct resource type?

the 2_spades resource is extended from Resource class and has a class_name CardResource. But Godot doesn’t recognise it as CardResource in code when I preload and try to use it.

And this is the code of the resource class CardResource

class_name CardResource extends Resource

@export_category('Images')
@export var image: Texture


@export_category('Values')
@export var card_value: C.CardValue = C.CardValue.NONE
@export var card_suit: C.CardSuit = C.CardSuit.NONE

Also, as you might see on the screenshot, the resource that is preloaded is strictly typed. And there is no problem with this line. But when I try to pass it to a setup method that expects exactly that type, it says that this is not the right one.

1 Like