-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Error: Could not find type "x" in the current scope when duplicating script files #82392
Comments
See also: |
This bug happened to me too on Godot v4.1.stable.mono as well. Thanks for the bug report @nicom7. The workaround to delete |
I tried re-save all missing scripts. Editor will find these "x". And these types will be store in ".godot/global_script_class_cache.cfg" file of project root. |
One workaround for resolving this issue appears to be:
|
This is very unpleasant, especially when you had a large project and had to download it to another PC, basically all scripts are like this. Is there any record of a possible solution? |
I submit ".godot/global_script_class_cache.cfg" file to remote. It seems working for me. Event I think it's not a good solution. |
Important Update for those who will fix thisIn my project there was a class that generated this import error, crashing the editor, and after restarting the However, changing my file to extend the class traditionally using the name of the base class for the script path solved the problem, when importing now it doesn't crash and when I restart the editor follows the normal editor flow recognizing all scripts and correctly filling the file I hope that identifying these problematic scripts will be useful to everyone. My theory is that the importer gets lost when it comes to importing scripts that have a hierarchy. It is worth noting that in my case the problematic script extended a class that extended another class that was in a gdextension. |
I also encountered this error message recently when importing this inventory system addon, which I believe is the same project as mentioned in scriptsengineer's post. The issue in my case was an existing script I wrote with the same name as one of the C++ classes in the addon. After rolling back and renaming the script I could import the addon without errors. It was very confusing at the time, as it seemed to corrupt everything that referenced a gdextension class in some way, including previously working addons. I'm not sure if it's exactly the same error because of this. |
Same problem with dialogue manager addon. When i delete /.godot folder and open project, i get error "Could not find type "x" in the current scope" for every custom class_name in this addon. @Umopepisdn method works, but it's a nightmare, because addon has many custom classes and I have to comment/uncomment every one. Tested on 4.2.1 and 4.2.2 |
I've also encountered this bug in my project. Godot 4.2.2 on Windows 10 22H2. |
Also encountering this, seems to be when using add-ons. I'm using the C# version, suspecting there is something going on with c# and gdscript not fully connecting with each other. Getting the error with dialogic, dialogue manager and also a music manager addon. Using latest Godot 4.3 RC3 |
Just suspecting this one might be something a lot of users run into. Any way to ask for priority on this issue? Still happening with 4.3 Stable. |
I'm experiencing this with the Godot Voxels library.
In my scenario this doesn't work since the class that is throwing the error In my case though, I only have the issue when exporting the project. |
Hi, I have the same issue on 4.4 dev 3 (not mono) (macos Sonoma 14.4.1) when using ImGui addon. It starts working after i remove the .godot folder. But doing it every time before I open the project is annoying. |
Is there any ETA on this issue please? It's really annoying, I thought it would have higher priority :) |
I believe I have same issue I wanted to do static typing for method and variable name suggestions. |
Happened to me after renaming a script then adding |
I've updated to 4.4 beta 1 and do not see this error anymore. Is it fixed (or am I just having a "temporarily" working project)? |
Godot version
v4.1.stable.mono.official [9704596]
System information
Godot v4.1.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (NVIDIA; 31.0.15.3623) - Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 Threads)
Issue description
Duplicating a
type_1.gd
file to create a new scripttype_2.gd
out of the existing one will cause parser errors likeCould not find type "Type1" in the current scope
for other scripts that depend on the existingType1
class.Reloading the project has no effect but removing the
.godot
folder will fix the issue. In the same way, the attached example doesn't include thetype_2.gd
script because the issue doesn't occur when the project has not been opened before.Steps to reproduce
main.gd
type_1.gd
with an explicitclass_name Type1
main.gd
script add a variable of typeType1
type_1.gd
file totype_2.gd
and rename the class name toType2
Minimal reproduction project
bug_unresolved_type.zip
The text was updated successfully, but these errors were encountered: