godot: Can no longer instantiate subclasses
Operating system or device: Arch Linux
Issue description (what happened, and what was expected): I get an “Invalid call. Nonexistent function ‘new’ in base ‘GDScript’.” error when I attempt to instantiate a subclass defined within a class file. This has worked in the past and broke within the last week in master.
Example:
var Bar = preload("Bar.gd")
class Foo:
var x = 0
func new(y):
x = y
func _ready():
# This works
var bar = Bar.new(1)
# This does not work
var foo = Foo.new(1)
Steps to reproduce: I provided a simple sample project.
Link to minimal example project (optional but very welcome): SubclassTest.zip
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (14 by maintainers)
Commits related to this issue
- -wip on addon editor -fixes instantiable subclasses not working, as reported in #3871 — committed to godotengine/godot by reduz 8 years ago
I believe you need to name the constructor
_init
and notnew
.