0 votes

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

asked Dec 14, 2019 in Engine by ATom 1 (209 points)
edited Dec 14, 2019 by ATom 1

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')
answered Dec 14, 2019 by SpkingR (126 points)
selected Dec 14, 2019 by ATom 1
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.