Derived class of GDExtension class will not call _process if the parent does not also override it

Godot Version

4.2

Question

Hello! I am working on GDExtension this summer, and noticed something odd when I was cleaning up one of my demos.

I have a GDExtension class derived from MeshInstance3D that does not override the _process function. I will call this class Class1. If I create another GDExtension class (Class2) that inherits from Class1 and I want to override _process, it will not call the _process function for Class2. Upon creating a _process override in Class1, Class2’s _process will be called. As far as I know, this should not be necessary.

  1. Does anyone know why this happens?
  2. Should I create a bug report? (If I am doing something wrong, I recognize that the answer to this will be “No.” :sweat_smile:)

Thank you for your time! :slight_smile:

(Note: The parent class of Class1 doesn’t matter; as long as it is a Node. )

I was not able to reproduce this. Can you post the code that causes this issue?

1 Like

Hello!

I always appreciate your engagement on my posts. Thank you for the time you spent trying to reproduce! I apologize if you feel as though I have wasted any of your time when you see the root of the mistake. Instead of attaching the code, I have the solution and explanation of what I learned, so that you don’t have to waste more time on this one.

Upon hearing that you could not reproduce the problem, I set out on a quest to find the bug myself so that you wouldn’t have to waste time finding what I knew would ultimately be a stupid mistake. I made a fresh project and also couldn’t reproduce, so I needed to discover what was different between them.

It was a silly one; I hadn’t added a _bind_methods to Class2.

I hadn’t realized how important _bind_methods was or what it actually was responsible for, since I usually leave the function body empty. I thought that my child classes could just inherit their parent class’s empty _bind_methods and call it a day.

Not true; a truly terrible assumption. Really not sure where I came up with that after re-reading the docs.

Since the child class did not have a _bind_methods, I believe it was not set-up as a callback for signals and/or Godot didn’t know it had overridden _process… Thus the root of the problem.

Links to relevant lines in the documentation:

I appreciate the time spent on helping me as I learn GDExtension (and become a better programmer). Please let me know if you have any questions or corrections! Thank you again!

1 Like

No time was wasted! Thank you for looking into this, finding, and writing up the solution.

This is some good to know information.

1 Like