You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tested it and found out that the functions of FarmerCard.jsx aren't called when the node is inherited.
It only works if the FarmerCard.tscn extends from godot.Node (I use TS here which includes the Card.jsx code in the other file):
prints:
This leads us to a workaround and a question/bug.
Bug
If it's possible with gdscrip it should be possible in JS/TS. The question is how and who can solve it ^.^
Workaround - Separate Nodes and code
If you have Card.tscn you can add other Child Nodes and use it as a pure UI Node without any scripts attached.
Inside FarmerCard.tscn you add your FarmerCard.jsx which extends the Card.jsx and both _ready functions should be called.
With this approach, we add some complexity, because you need to add scripts to children inside Card.jsx by code with set_script. On the other hand, you would separate your "UI" and "Code" which is a common pattern, I guess :P
Card.tscn
Card.jsx
FarmerCard.tscn
FarmerCard.jsx
run
FarmerCard.tscn
scene, console output(missing "FarmerCard _ready" log):error by exit the program:
The text was updated successfully, but these errors were encountered: