Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Class Constructor 'new' not found only in release exports #80526

Closed
CorbinSteele opened this issue Aug 11, 2023 · 2 comments · Fixed by #90552
Closed

Custom Class Constructor 'new' not found only in release exports #80526

CorbinSteele opened this issue Aug 11, 2023 · 2 comments · Fixed by #90552

Comments

@CorbinSteele
Copy link

CorbinSteele commented Aug 11, 2023

Godot version

v4.1.stable.official [9704596]

System information

Godot v4.1.stable - Linux Mint 19.1 (Tessa) - Vulkan (Compatibility)

Issue description

The code var constructor : Callable = CustomClass.new works exactly as expected in the editor and in debug exports.

In release exports however, this causes:
SCRIPT ERROR: Parse Error: Cannot find member "new" in base "CustomClass".

This error seems to always occur regardless of what CustomClass extends, and regardless of whether _init is defined.

WORKAROUND:
Wrapping every constructor callable in func(): return CustomClass.new() solves this issue, but is annoying and shouldn't be something discovered only upon attempting a release export.

Steps to reproduce

This is very simple to reproduce, but I created a reproduction project anyway just in case something weird is going on with the default Linux export presets.
Running it in the editor or after exporting it as a debug export will print SUCCESS.
Exporting it as a release export and running it will print FAILED and make the error apparent (if run from console).

Minimal reproduction project

Test.zip

@dalexeev dalexeev added this to the 4.2 milestone Aug 13, 2023
@YuriSizov YuriSizov modified the milestones: 4.2, 4.3 Nov 15, 2023
@rilifon
Copy link

rilifon commented Jan 23, 2024

This also happened on my project. Using Godot 4.2.1, Windows

Thank you so much for the workaround!!

Hopefully this will be fixed soon, just as you mentioned, this only happened in the release version.

@KlugeNico
Copy link

KlugeNico commented May 14, 2024

I still get this error, when exporting without debug. I tried with 4.2 and commit e761982979fa3953ce7dd28c2337e7ae81ca5630 as cherry-pick, but also on master.

In my case I pass the new function as a callable argument to a function:
create_obj_and_do_something(MyClass.new)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants