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

Several mods cannot extend the same script with a class_name #338

Open
Tracked by #340
ColdCalzone opened this issue Sep 24, 2023 · 3 comments
Open
Tracked by #340

Several mods cannot extend the same script with a class_name #338

ColdCalzone opened this issue Sep 24, 2023 · 3 comments
Labels
4.x bug Something isn't working
Milestone

Comments

@ColdCalzone
Copy link

In Godot 4, having two or more mods extend the same script causes every script after the first to be ignored. I've found that parent_script.resource_path is blank after the first extension takes over.
After modifying the apply_extension function to sidestep that issue, I found that every extension except the last one is ignored.

@KANAjetzt KANAjetzt added bug Something isn't working 4.x labels Sep 25, 2023
@KANAjetzt KANAjetzt added this to the 4.x - 6.2.0 milestone Sep 25, 2023
@ColdCalzone
Copy link
Author

I've discovered the problem isn't with every script, it only happens when the script is declared with a class_name at the top, or extends a script declared with a class_name. Autoloads and regular scripts can be extended just fine.

@KANAjetzt
Copy link
Member

KANAjetzt commented Oct 24, 2023

I'm currently testing some older Godot version and got this interesting error message on 4.0-RC1
image
Parser Error: Could not find class "Base" in "res://base.gd"

Same in

  • 4.0-beta15
  • 4.0-beta14
  • 4.0-beta10
  • 4.0-beta8
  • 4.0-beta6

4.0-beta1 / 4.0-beta3 / 4.0-beta5
No error but the second "script_extension" overrides the first one resulting in this print out:

base
extend1 - _ready()
do_stuff

The class_name has no effect on this.

https://github.com/godotengine/godot/commits/master/core/io/resource_loader.cpp

@KANAjetzt KANAjetzt changed the title Several mods cannot extend the same script Several mods cannot extend the same script with a class_name Sep 2, 2024
@KANAjetzt
Copy link
Member

Updated the title for clarity. Also, see godotengine/godot#83542 for more details about this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants