Godot version
4.0-alpha4
System information
Ubuntu, Nvidia, Vulkan
Issue description
Calling new() on a GDSscript that has been registered via class_name causes the aforementioned error when the class is referenced first in an built-in script.
When the class has been extended or instantiated beforehand, the error does not occur.
The error does also not occur when the GDSscript is loaded via loador preload.
Steps to reproduce
- Create a blank project
- Create a new script with contents:
extends Node
class_name MyClass
- Create a new scene, add any kind of root node and attach a built-in script with contents:
extends Node
func _ready():
MyClass.new()
- Press F6 and notice error log:
Invalid call. Nonexistent function 'new' in base 'GDScript'.
Minimal reproduction project
godot_4_gdscript_new_bug.zip