0 votes

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.

Godot version 3.2.3
in Engine by (15 points)

1 Answer

0 votes
Best answer

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

by (8,528 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.