Open TandersT opened 6 months ago
I started having the same issues when I added the Qodot plugin into my project (Godot 4.2.1 mono). Making a change in my C# code, and then running the game makes several scripts from the plugin fail to load, but running the game a 2nd time would result in no issues. I initially thought this was a problem with the plugin, but after reading your post, it's clearly something to do with the engine itself.
Since Godot was telling me it was a parse error (just like in your post), I made sure that all of the scripts were encoded in UTF-8 without BOM, but that didn't fix it. I also attempted to change the file and class names of the scripts that were causing the issues, but once again it didn't fix it.
The last thing I tried was that I went through every single script that was failing to load and removed the type hints from all of the variables and functions, which ended up making the errors show up less frequently, but they were still there.
I started having the same issues when I added the Qodot plugin into my project (Godot 4.2.1 mono). Making a change in my C# code, and then running the game makes several scripts from the plugin fail to load, but running the game a 2nd time would result in no issues. I initially thought this was a problem with the plugin, but after reading your post, it's clearly something to do with the engine itself.
Since Godot was telling me it was a parse error (just like in your post), I made sure that all of the scripts were encoded in UTF-8 without BOM, but that didn't fix it. I also attempted to change the file and class names of the scripts that were causing the issues, but once again it didn't fix it.
The last thing I tried was that I went through every single script that was failing to load and removed the type hints from all of the variables and functions, which ended up making the errors show up less frequently, but they were still there.
Yeah for sure. I am able to avoid the error by also closing and reopening the project, or by building the project in the terminal and then running it from the terminal or editor, though that causes some other errors due to manipulating the editor from an external tool.
Here's the error in action
I started having the same issues when I added the Qodot plugin into my project (Godot 4.2.1 mono). Making a change in my C# code, and then running the game makes several scripts from the plugin fail to load, but running the game a 2nd time would result in no issues. I initially thought this was a problem with the plugin, but after reading your post, it's clearly something to do with the engine itself.
Since Godot was telling me it was a parse error (just like in your post), I made sure that all of the scripts were encoded in UTF-8 without BOM, but that didn't fix it. I also attempted to change the file and class names of the scripts that were causing the issues, but once again it didn't fix it.
The last thing I tried was that I went through every single script that was failing to load and removed the type hints from all of the variables and functions, which ended up making the errors show up less frequently, but they were still there.
It seems like I found a fix, depending on your setup!
You can disable GD script warnings. If you do so, boom no issue. Which is odd, as if I push through before, the scripts would not load correctly, but apparently, if you ignore them it all works.
So, if you work entierly in C#, you can disable the warnings, and the project no longer fails.
They can be disabled in debug/GDScript/enable. Requires advanced settings to be true.
Alas I was too quick, the bug has returned in full swing.
I am seeing the same issue on both 4.2.2 and 4.3-dev6. The first run after making changes to C# scripts, godot will raise several parse errors on the types provided by the plugins. There are no errors running the project a second time. In my project's case the plugins are Dialogic and Phantom Camera.
Adding some additional information -
Two "workarounds" with various degrees of around-working - 1) Close the godot editor and run the project through your IDE. Solid workaround when you're only changing code and don't need to edit any scenes or exported variables. 2) Run godot with the console .exe. The plugin and gdextension scripts still fail to load for the first run after making changes, but the errors just get spit out into the console instead of halting the game, so you can more quickly test anything that doesn't depend on them. It also makes rerunning the project after the failure much faster. Unfortunately this loses breakpoint debugging, see #84314
An MRP or clear steps to reproduce are necessary here. It'll be hard to assess the problem and fix it if we can't reproduce.
Tested versions
Tested in 4.2.1 mono and v4.3-dev5 mono
System information
Godot v4.2.1.stable.mono - Windows 10.0.22000 - Vulkan (Forward+) - dedicated AMD Radeon RX 5700 (Advanced Micro Devices, Inc.; 31.0.21023.2010) - Intel(R) Core(TM) i9-9900KF CPU @ 3.60GHz (16 Threads)
Issue description
I use some plugins; GameGui (https://github.com/brombres/Godot-GameGUI) and Dialogue Manager (https://github.com/nathanhoad/godot_dialogue_manager)
For some strange reason, whenever I make any changes to my code in C#, the first run of the project causes various GD scripts to fail from these 2 plugins.
Not sure what the files that fail shares.
Whenever I run the project the second time, it then runs without issues. If I build the project first and then run it, also no issue.
When I first installed GameGui there was no issue. The error suddenly started happening.
I have tried to use notepad for editing, to ensure VSCode wasn't causing the issue, but the same error happened. It seems to happen when Godot has to reload the scripts.
All the errors combined:
E 0:00:38:0338 load: Failed to load script "res://addons/dialogue_manager/test_scene.gd" with error "Parse error". <C++ Source> modules/gdscript/gdscript.cpp:2788 @ load()
Example of errors in the code
Steps to reproduce
I have tried to no avail to recreate the bug...
Minimal reproduction project (MRP)
I have tried to no avail to recreate the bug...