Can not preload custom resource when having export variable of Packedscene

Godot Version

v4.3.stable.steam [77dcf97d8]

i have this item_data.gd

extends Resource
class_name ItemData

@export var name : String = “”
@export_multiline var description : String = “”
@export var stackable : bool = false
@export var texture : AtlasTexture
@export var scene : PackedScene

and i made oden_desk.tres from item_data.gd
with all variables assigned

then on oden_desk.gd i preload
@export var furniture_resoure : ItemData = preload(“res://01_Scenes/006_Player_Currencies/all_furnitures/kitchen/oden_desk.tres”) as ItemData

This error pop up ‘Trying to assign value of type ‘Resource’ to a variable of type ‘item_data.gd’.’

but when i remove PackedScene (var scene = null), no error occured and preload successfully

Question

is there any workaround to export packedscene along with this custom resource.

is the custom resource cannot export packedscene ?

Since ItemData is a Resource you won’t need to preload it like a packed scene. Just write:

@export var furniture_resource : ItemData

You will then be able to drag and drop your custom resource in the export field.

I am not quite sure if I answered your question. If not just ask again :wink: