Skip to content

GDExtension: Classes without default constructor break reloading #96823

Closed
@Bromeon

Description

@Bromeon

Tested versions

4.3-stable and before

System information

All systems

Issue description

GDExtension allows classes to be registered without a default constructor. They can either have custom constructors (static methods) that are invokable from GDScript, or non-exposed constructors only available in the binding language. This can be done by not providing create and recreate function pointers during class registration, and optionally marking a class as abstract.

However, without a recreate callback, Godot emits the error message:

Extension marked as reloadable, but attempted to register class 'MyClass' which doesn't support reloading. Perhaps your language binding don't support it? Reloading disabled for this extension.

This might be a bit too much because:

  • Not having a recreate callback shouldn't be a problem until there are actual instances of such a class to be reloaded.
  • Even then, Godot shouldn't disable reloading for the entire extension just because of one class.

The only workaround seems to be providing a dummy recreate function, although I haven't tested this, and I don't know if it has any other implications.

Steps to reproduce

Set reloadable = true in the .gdextension file.
Register a class in GDExtension with create_instance_func and recreate_instance_func function pointers set to null.

Minimal reproduction project (MRP)

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions