0 votes

Is there a way to automatically inherit the parent function like ready _process _entertree ...in gdscript

in Engine by (206 points)
edited by

Could you please specify a bit more? I am not sure what exactly you want to do.

In ready() you don't have to write .ready(),

1 Answer

+1 vote
Best answer

I think you must manually call the parent function otherwise the parent function behaviour will be overridden silently, a simple example like this:

class_name BaseNode
func parent_func():
    print('parent function calls')

And the inherited class:

extends "res://classes/BaseNode.gd"
func parent_func():
    .parent_func() # this line calls the parent function
    print('child function calls')
by (126 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 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.