-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
"Bad address index" error is printed when there is a cyclic reference in a script #74253
Comments
There is a cycle between Blue and Green. The inheritance relationship in scenes is opposite to that in scripts. Using |
Ah good catch, is this a case where a cycle should be detected and give a more meaningful message? |
Would be great to have some more direction when attempting to fix such errors. Even the filenames which are cyclic would be a great improvement. Actually I'm fine without circular dependance, but there's very little tooling at the moment to help with debugging this. Currently refactoring a bit of my large project, now I'm dealing with this issue again and there's really not much to do except comment out parts of a large section of my codebase until I find the single line which is causing the issue. Previously it was caused by referencing a |
I went and wrote the following gist: Code is a bit messy as I was in a rush, but it works to detect such circular dependencies and can also output a graph of your project. The class structure of my game: The circular dependencies detected: |
4.1 dev:
|
@dalexeev this is a different issue I'm pretty sure.
Most likely means that your scene is missing, or corrupted in some other way? |
I think the If you replace CC @adamscott |
@dalexeev seems like you are running an example scene anyway? Perhaps you could post the zip here? |
Currently, it's not possible to load cyclically scenes, ie. scenes with scripts that their definitions depend on the loading script. Originally, I had intended to support this, but my PR couldn't be merged. See the discussion for more info. |
Just in case it helps someone else: I came across something that seems very similar to this bug. I had the same 'bad address index' error message. Mine was related to type annotations: I couldn't have It was also related to load()ing scenes (of type A, or rather inheriting from A) in an autoload Foo, and my main scene was inheriting from B. I fixed it in the autoload Foo, simply by transforming Seemingly, without the |
IntermissionPanel and BeachBallTweak reference each other, because SceneTreeTweaks describe how to modify an IntermissionPanel and IntermissionPanel includes a list of all scene tree tweaks. This circular reference makes it so that BeachBallTweak (and all other tweaks) can not be opened in the editor, because of Godot #74253 (godotengine/godot#74253) I've resolved the circular reference by having these scenes initialized at runtime with a 'load' command, rather than when the scene is loaded with a 'preload' command.
Godot version
v4.0.stable.official [92bee43]
System information
macOS 13.2.1 (22D68), Intel Intel(R) Iris(TM) Plus Graphics - Supported, Integrated Vulkan API 1.2.231 - Forward+
Issue description
Howdy 👋
I came across a weird error that I've narrowed down to:
When using a combination of those, I get:
Steps to reproduce
This is a very reduced version of a project I work on, so don't expect it to "make sense".
Since the code is so short, here's:
In the same fashion,
blue.tscn
is inherited fromred.tscn
andgreen.tscn
is inherited fromblue.tscn
.When this code runs, it fails on
var something = 1
with the error:Maybe related to this?
godot/modules/gdscript/gdscript_vm.cpp
Line 633 in 31eccb5
There are a few changes that prevent the code from failing:
var something = 1
Red
and/orBlue
and/orGreen
extends fromColorRect
green.gd
script from thegreen.tscn
sceneMinimal reproduction project
Archive.zip
The text was updated successfully, but these errors were encountered: