EditorImportPlugin JSON/PNG combination order of import issue

Godot Version

4.6

Question

I wrote a custom EditorImportPlugin to import a texture atlas in a custom way. It handles importing the json which defines the atlas, but I rely on Godot itself to handle loading the PNG.

When I create a new atlas (png + json) I often have an issue where I think the JSON gets loaded first, which tries to make AtlasTextures which reference the PNG, which hasn’t been fully loaded yet. All of the AtlasTextures are broken, pointing to a null texture as their atlas.

Is there a way to handle this properly, to either:

  • Ensure a resource is loaded before another, or
  • Override importing the json and the png at the same time, so the correct order can be handled manually?

Show us the code.

1 Like

Implement the EditorImportPlugin._get_import_order() callback.

3 Likes