How can I see the fields in a custom file type in the editor?

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

I have a custom class type that I am saving to a .json file. This class contains strings, ints, and two arrays of subclasses, also containing strings and ints. I want to be able to see these files in the editor, and use them as a custom resource type.

I followed the import plugin tutorial, thinking that I could get my files to show up in the editor. I think that I’m going wrong here:

func get_resource_type():
return "MazeScenario"

Looking at the tutorial, they loaded an existing resource type (SpatialMaterial) here. Meaning that all they did was create a subset of something that already exists. There isn’t a built in type that I can easily put my data into, I was hoping that I could drag and drop a resource from a .maze file into a MazeScenario resource in the editor.

I’m coming from Unity to Godot, in Unity, this was all done via a [Serializeable] class. I could load my custom object from a file, and then see it and change its values right in the editor. I’m not sure if I’m just using it wrong, but I am hoping that there is a way to achieve the same effect in Godot.

The frustrating part is that I feel like I’m so close, and I’m just not sure what I need to Google to get over the hump. I can see my files in the FileSystem window, thanks to the custom import plugin I wrote. I can export a Resource variable and select New MazeScenario in the dropdown. But I can’t drag my scenario.maze file into the resource field, and if I click “load” and find it manually (using the * all file types option), then it shows up with a little .txt icon, but it doesn’t show me any of the custom fields.

:bust_in_silhouette: Reply From: exuin

I think what you’re looking for are export variables.