You can find this sample project on github.
My intent is to create an
Models scenes, which implement Type Object Pattern. In few words: an
Actor is a container with common logic (say, movement, actions etc),
Model should define the looks.
In the sample project there are
Actor scene and class,
Model2 scenes with corresponding classes. Models has
Sprite child node to distinguish between them. Also models inherit from
ModelInterface (I really miss
interface feature from other oop programming languages) and have an
res://Model folder there is a
ModelFactory class to create models, base on some parameter (say their type id).
Actor is a
tool and I want to switch its model in the editor.
current_model_type variable and corresponding setter, which calls
ModelFactory to create a new model, runs its
init method and attaches it to
The problem is, that in editor I get an error:
res://Actor/Actor.gd:27 - Invalid call. Nonexistent function 'init' in base 'Node2D (Model1.gd)'.
but when running the project everything works as intended. Should I load the scenes in a different way?
Thanks for any help!