Open nicom7 opened 11 months ago
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 .godot/
worked for me as well.
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. So I tried remove all the lines in that file. And issues appear again. But when I reset back lines in that file. Issues are gone. I have added ".godot/global_script_class_cache.cfg" file to my .gitignore to prevent these issues happening again when I download my project from a new computer.
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?
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.
In my project there was a class that generated this import error, crashing the editor, and after restarting the .godot\global_script_class_cache.cfg file
it was empty.
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 .godot\global_script_class_cache.cfg
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.
My changes:
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.
One workaround for resolving this issue appears to be:
1. Comment out the class_name statement 2. Save 3. Uncomment class_name statement
In my scenario this doesn't work since the class that is throwing the error VoxelStreamRegionFiles
is baked into the custom build of the engine :)
In my case though, I only have the issue when exporting the project.
Godot version
v4.1.stable.mono.official [970459615]
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