0 votes

Hello, I have a dude, and I wasn't able to find out about it, but I guess it's true.

When you inherit, are you reusing nodes from the inherited base although with different values? (I say it because exported values can be changed on inherited scenes, and they'll be saved with the new scene) or it's just a comfortable way to duplicate scenes in Godot?

For example, if we create a base level and inherit it to make all levels it will be the same as duplicating that base scene many times? Or nodes would be the same but load in a different way so meanwhile duplicating increases game size, inherit will save resources because of reusing node data?

Godot version Godot v3.4.4
in Engine by (40 points)

1 Answer

+1 vote
Best answer

When using the concept of inheritance, the attributes from the base class can be used and extended in subsequent classes or instances. So instead of duplicating all of the attributes of the base class, they can be directly used. More resources don't need to be used. What's even better is that these attributes can be used in the inherited class or instance in different ways (for example, assigning a different number to a variable so that a member function operates in different ways). Bare in mind that changing the base class also changes the inherited classes/instances.

by (3,162 points)
selected by
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.