0 votes

Hey there, so I've basically got a scene structure like this: I have a scene called PartyMember which is basically a kinematic body/animated sprite combo. I'd like to have an exported variable of type PartyMember in this scene so that inherited scenes can use it. However, when I create a scene that inherits PartyMember, the option to change the value is missing. Is this a shortcoming of Godot or am I missing something? Thanks.

asked Feb 12 in Engine by Sethington (23 points)

2 Answers

0 votes
Best answer

It ended up working when I added the line

class_name PartyMember

to the script, now children have the export variables.

answered Feb 12 by Sethington (23 points)
0 votes

Use "export var"
Example: export (String) var MemberType
If your scene inherit the script that contains export (String) var MemberType, then yes this scene will have the option to change the value of this property inside the Inspector, too. (Just put the scene as a child node is not the same as extends its parent class, a script is also a class that extends the class of a node)
If you want a scene to be reused, save this scene. Later you can just load it and instance it, the options you exported will also be there.

answered Feb 12 by Sween123 (758 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.