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.

in Engine by (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.

by (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.

by (803 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.
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 webmaster@godotengine.org with your username.