What exactly is exported into the game artifact?

Sorry if my title is not a good one. The problem itself is too complex for me to summarize :cry:

Game Artifact refers to the executable binary generated after you hit the Export Project button in Export window.
I’ll use Game Artifact and Exported Game to describe it below.

Godot Version

4.5.1-mono

Question

There’re .xlsx files imported as custom Resources by plugin in my project.
Will the .xlsx files be exported to game artifact as well?

TL;DR

I’ve done…

  • Importing .xlsx files to my project through a custom import plugin
  • Converting them to my own resource type during import, and only saving the resource
  • Load my resources by GD.Load<MyData>("res://path/to/data.xlsx")

I’m expecting…

  • .xlsx files are NOT exported to my game artifact
  • My own resources are exported to my game

I don’t know…

  • Are .xlsx files exported to my game exactly?

Detailed Description

I’m currently using .xlsx tables to configure my game data.
However, .xlsx files are large and costy to parse, so I wrote a EditorImportPlugin to import .xlsx files, converting them into My Custom Resource Type during the import process.

My import plugin goes like this:

public partial class XlsxImporter : EditorImportPlugin
{
    public override string _GetImporterName() => "my.xlsx";
    public override string _GetVisibleName() => "My Xlsx";

    public override string[] _GetRecognizedExtensions() => ["xlsx"];  // Accept .xlsx files as input
    public override string _GetSaveExtension() => "tres";  // Only save my own resource
    public override string _GetResourceType() => "MyData";

    public override Array<Dictionary> _GetImportOptions(string path, int presetIndex) => [];

    // Import Xlsx
    // The actual file is parsed during import and only my own resource is saved
    public override Error _Import(string sourceFile, 
                                  string savePath, 
                                  Dictionary options, 
                                  Array<string> platformVariants, 
                                  Array<string> genFiles)
    {
        // Use some C# lib to parse xlsx files, then convert them to my data resource
        var table = SomeCollUtils.ReadXlsx(sourceFile);
        var realResource = new MyData
        {
            // MyData contains nothing more than a CSV string, I'll handle it at runtime
            CSV = table.ConvertToCSV();
        };

        // Save my custom resource
        return ResourceSaver.Save(story, $"{savePath}.{_GetSaveExtension()}");
    }
}

It worked out fine. The .xlsx files show up in the FileSystem dock, and I’m able to load my resource using GD.Load<MyData>("res://path/to/data.xlsx"), but question comes when I want to export my game.

In the Export window I tried to exclude .xlsx files as I don’t want them to present in my exported game artifact, But this lead to my exported game not being able to load the MyData resource as well.

If I don’t exclude them, my game would work, but I’m suspecting that those .xlsx files goes into my exported game as well, which is not what I’m willing to see.

The Import process — Godot Engine (stable) documentation in English explains that imported resources are saved in the res://.godot/imported folder, but it’s not explained which resources exactly will go into the exported game.

Thank you for your help!

Export from command line. You should be able to see what is getting packed.

2 Likes

Thank you so much!
The .xlsx files are not exported indeed :smiley: