Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot v4 editor needs restart to detect inherited method. #70841

Open
PabloNeirotti opened this issue Jan 2, 2023 · 12 comments
Open

Godot v4 editor needs restart to detect inherited method. #70841

PabloNeirotti opened this issue Jan 2, 2023 · 12 comments

Comments

@PabloNeirotti
Copy link

PabloNeirotti commented Jan 2, 2023


Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.


Godot version

v4.0.beta10.official [d0398f6]

System information

Apple M1 Max - macOS Ventura 13.1 (22C65)

Issue description

I'm actually not sure when this bug was introduced, or if it exists in v3 too.

Adding a new method on a super class, and then calling it from an extending class, triggers a "not found" error in the editor. The code however can run fine when running the scene.

See attached video:

Godot.inherited.method.bug.mov

Steps to reproduce

  • Create a few classes that inherit from each other. Not sure how many levels of inheritance is needed to trigger this, but it does for me when using 3 or 4 levels. I.e: ClassAClassBClassCClassD
  • Save
  • Define a method at the top-most super class in the inheritance chain, i.e: ClassA
  • Try to call the method on the last class in the chain, i.e: ClassD
  • The editor doesn't detect the method.
  • Save – It still isn't detected.
  • Close Godot and open the project again.
  • Now the method is detected.

Minimal reproduction project

I am sharing the project I created to reproduce some bugs in the editor, but it still requires redoing the steps on your end to trigger this, since restarting the editor fixes the issue.

Godot Crash Test.zip

@PabloNeirotti
Copy link
Author

Okay I just tested this on beta 11, and the issue persists. I still need to restart Godot every time I create a new function 😅 or I'll get a parser error.

The Output throws this when I save, with pending changes both in the super class and the inheriting class:

  res://MyCustomClass.gd:44 - Parse Error: Function "new_func()" not found in base self.
  modules/gdscript/gdscript_compiler.cpp:2339 - Condition "!base->is_valid() && !base->reloading" is true. Returning: ERR_BUG
  modules/gdscript/gdscript_compiler.cpp:2339 - Condition "!base->is_valid() && !base->reloading" is true. Returning: ERR_BUG

For context, I'm trying to call new_func() from the inheriting class, which I just defined in the super class.

@LunaticWyrm467
Copy link

LunaticWyrm467 commented Feb 18, 2023

I can verify that I also experience this issue in Release Candidate 1.

@Flatgub
Copy link

Flatgub commented Mar 14, 2023

Confirming that I'm also experiencing this in 4.0 stable

@Iddmeister
Copy link

Experiencing this in 4.1 stable as well

@PabloNeirotti
Copy link
Author

I just made it a habit of restarting the project every time I create a method. It's very slow, but better than getting a typo on your code 😄

@simplebitmads
Copy link

simplebitmads commented Sep 26, 2023

experiencing the same issue using Godot v4.1.1-stable-win64 (it involves both variables and functions)

@PGPereira
Copy link

experiencing this issue, but with at first level of inheritance

@Aziroshin
Copy link

Aziroshin commented Feb 7, 2024

Experiencing this as well with super(). (Godot 4.2.1.stable.official [b09f793])

@hsoler
Copy link

hsoler commented Feb 8, 2024

Hey, I know I might be late, but I'm using Godot 4.2 stable and I am experiencing this very same problem.

Weirdly, the bug was only triggered to me when I wrote a function in the body of Class C (which extends Class B which extends Class A which extends CharacterBody2D) and called it from another function in Class D (which extends Class C).

I've just found an easy turn around: I transformed my Class C function into a Callable, and now it detects no error when calling its "call" method from Class D.

Not the ideal solution but one nonetheless...

By the way, I wanted to try to find the source of the error myself and craft a bug fix. Is there any documentation besides the "Engine Development" in "Contribution" in "Godot Docs" that I could look into for that purpose?

Thanks for the attention.

@Kylemcarthur
Copy link

This issue still occurs in v4.2.2.stable.official [15073af]

It happens as far as I can tell with any and all parts of a custom class, not just methods, nor just inheritance. The editor will just seemingly decide that it doesn't feel like updating its list of classes and anything contained therein. So I won't be able to access properties, methods, or sometimes even the class itself. It feels like some kind of cache issue, but that's just an uninformed hunch.

It's how I get errors like this
image
despite the code being
image
and the only way to get the editor to recognize the change is to reload the project. If this happened like once a month, it'd be an annoyance, sure, but it happens constantly which turns it into a workflow nightmare.

I have seen really no rhyme or reason to it over the past 6 months. Sometimes Classes play nice, other times they go completely nuclear. It's maddening, especially for newer people who don't realize it's an engine bug happening, and waste hours trying to figure out what they're doing wrong.

@rune-scape
Copy link
Contributor

havent tested, but should be fixed by #92616

@akien-mga
Copy link
Member

havent tested, but should be fixed by #92616

I tried to test but I didn't manage to reproduce the bug in 4.2.2-stable after several attempts at following the steps in the OP.

So if someone who can reproduce the bug easily can test in 4.3-beta3 or later once it's released, that would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests