How can I exporting custom resource type?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Taburetk

For example, I have a custom resource EventHandler, and I want to export it like export (EventHandler) var event. But, if I try this, I will catch an error. I don’t want to export basicResource type. Should I write some kind of C++ extension? How can i do this?

Any reason why

export (Script) var event


export (PackedScene) var event

won’t work for you?

njamster | 2020-02-12 13:09

Script and PackedScene are engine resources, custom resources are something different.

Zylann | 2020-02-13 14:04

I see. Where could I read up on custom resources? Never used them so far.

njamster | 2020-02-13 15:00

:bust_in_silhouette: Reply From: Zylann

I’m not sure to remember what was the status on this, but the following thread may help: Custom-made resource types cannot be used in export statement · Issue #6763 · godotengine/godot · GitHub
It’s very old, you may need to read a bit.

This thread’s been archived but there’s a new thread in the godot-archives repository: Add first-class custom resource support · Issue #18 · godotengine/godot-proposals · GitHub
Apparently this feature is planned for Godot 4.0

Abstraction Mage | 2022-04-25 20:31