Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.


Inherits: ResourceImporter < RefCounted < Object

Registers a custom resource importer in the editor. Use the class to parse any file and import it as a new resource type.


EditorImportPlugins provide a way to extend the editor's resource import functionality. Use them to import resources from custom files or to provide alternatives to the editor's existing importers.

EditorImportPlugins work by associating with specific file extensions and a resource type. See _get_recognized_extensions and _get_resource_type. They may optionally specify some import presets that affect the import process. EditorImportPlugins are responsible for creating the resources and saving them in the .godot/imported directory (see ProjectSettings.application/config/use_hidden_project_data_directory).

Below is an example EditorImportPlugin that imports a Mesh from a file with the extension ".special" or ".spec":

extends EditorImportPlugin

func _get_importer_name():
    return "my.special.plugin"

func _get_visible_name():
    return "Special Mesh"

func _get_recognized_extensions():
    return ["special", "spec"]

func _get_save_extension():
    return "mesh"

func _get_resource_type():
    return "Mesh"

func _get_preset_count():
    return 1

func _get_preset_name(preset_index):
    return "Default"

func _get_import_options(path, preset_index):
    return [{"name": "my_option", "default_value": false}]

func _import(source_file, save_path, options, platform_variants, gen_files):
    var file = FileAccess.open(source_file, FileAccess.READ)
    if file == null:
        return FAILED
    var mesh = ArrayMesh.new()
    # Fill the Mesh with data read in "file", left as an exercise to the reader.

    var filename = save_path + "." + _get_save_extension()
    return ResourceSaver.save(mesh, filename)