godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.53k stars 21.26k forks source link

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

Open PabloNeirotti opened 1 year ago

PabloNeirotti commented 1 year ago

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


Godot version

v4.0.beta10.official [d0398f62f]

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:

https://user-images.githubusercontent.com/905216/210248116-f5af4af4-13f1-4755-a9a0-ffb49d571237.mov

Steps to reproduce

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 commented 1 year ago

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 commented 1 year ago

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

Flatgub commented 1 year ago

Confirming that I'm also experiencing this in 4.0 stable

Iddmeister commented 1 year ago

Experiencing this in 4.1 stable as well

PabloNeirotti commented 1 year ago

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 commented 1 year ago

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

PGPereira commented 1 year ago

experiencing this issue, but with at first level of inheritance

Aziroshin commented 9 months ago

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

hsoler commented 9 months ago

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 commented 5 months ago

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

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 commented 5 months ago

havent tested, but should be fixed by https://github.com/godotengine/godot/pull/92616

akien-mga commented 5 months ago

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.