Abstract parent classes need to be registered to godot.
See original GitHub issueDo not know if it is a feature or a bug.
I have this class:
import godot.annotation.RegisterClass
import godot.annotation.RegisterFunction
import godot.global.GD
@RegisterClass("Player")
class Player: BaseEntity() {
@RegisterFunction
override fun _ready(){
GD.print("I am the player!")
}
}
If BaseClass
is not registered to godot (should not be, as it is an abstract class), then the generated code will reference the non-existant BaseEntityRegistrar
.
This is also bad, as because that parent is abstract, the generated code is now wrong, as it tries to get its constructor.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Does GDScript have Interfaces and/ or abstract classes?
I suppose you need interfaces/abstract classes for organizing complexity and type enforcement. As @eska well mentioned, GDScript is made with ...
Read more >Abstract Classes - Godot Kotlin/JVM
You can define a abstract class and register it's members the same way as you do for normal classes. Under the hood, we...
Read more >How to properly abstract in GDScript? : r/godot - Reddit
I tried the Inherited Scene and detach the base script, add a new one and extend the base class, but that doesnt seem...
Read more >Custom Nodes in Godot 3.1: Class Name Keyword (tutorial)
You can register a GDScript file as a type in your entire project in Godot 3.1 with the class_name keyword. Learn how in...
Read more >Refactoring the Pong Game | Pong GDScript Basics | Ep 07
Refactoring our Pong Game. In this article I want to go over the following things: Truth of coding; Refactoring; Code Smells; Extract &...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I wouldn’t use
_ready
for the workaround. The engine will call this method if it’s registered. Use a method name of your own to minimize call overhead.Yap, adding a registered “_ready” method to the base class fixes it.