Is making a .tres file from a json list possible

Godot Version

As of writing this post the Godot version I’m using is v4.6.stable.official [89cea1439]

Question

I have to make around 150 resource files and I was wondering if I could speed up the process by creating and filling them with data from a json (or any of that nature) file. Is something like that possible and if yes then how should I go about it?

It is possible. If you only want to convert a file to a resource type you can make a import plugin. With this Godot will automatically convert a specified file type into a resource, it will do so transparently meaning the Godot filesystem panel may still show “MyData.json” but use your custom resource in development.

1 Like

This is possible. If you’re referring to loading the JSON file at runtime and reading it and assigning values to the Resources based on the JSON data, you’ll also need to include *.json files in the list of file types to include with the exported project in the export settings.

I think this could work but I would need to learn a bit more before I can say if it’s what i need. I have some additional questions

  1. Is it possible to import multiple files from a single file?
  2. Do the imported file(s) exist in the editor or only at runtime?

Overall thank you for your answer!

It is possible to import multiple files from a single file. The import function on the import plug-in only returns a single file, but you can make additional files and add them to the file array argument of the import function.

Since the plug-in works in the editor, the imported resources exist in the editor as well, not just on runtime.

1 Like

Thank you all so much for your help!

1 Like