This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

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.

in Engine by (28 points)

2 Answers

+2 votes
Best answer

It ended up working when I added the line

class_name PartyMember

to the script, now children have the export variables.

by (28 points)

Thanks, this worked for me too.

Not sure why the script that extends the other class also has to have a classname set in order for exported vars to be shown correctly in the interface, but adding a classname fixed the issue.

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.

by (813 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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.