Godot Version 4.4.1
Godot version: 4.4.1
OS/Platform: Windows 10
Issue description:
After declaring a global class using class_name UnitTest
, the editor cannot find the class until restart. This happens even after:
- Creating a new script with
class_name UnitTest
- Waiting for full project recompilation
- Checking that the script is in the correct directory
- Verifying there are no syntax errors
Steps to reproduce:
- Create a new script with
class_name UnitTest
- Try to use
UnitTest
in another script - Get errors:
- “Could not find type ‘UnitTest’ in the current scope”
- “Identifier ‘UnitTest’ not declared in the current scope”
- Restart the editor
- The class becomes available
Expected behavior:
The global class should be available immediately after declaration, without requiring editor restart.
Additional context:
- The issue seems related to
.godot/global_script_class_cache.cfg
- Deleting the
.godot
folder and reopening the project sometimes helps - This is a common issue that affects workflow when adding new global classes
Question:
Is this a known issue? Are there any workarounds besides restarting the editor?