godot: External script editing does not trigger reload of running game
Bugsquad edit: This bug has been confirmed several times already. No need to confirm it further.
Windows 10 Godot 3.0 v3.0.alpha.custom_build.af97525
Issue description:
Editing script file in external file editor with Sync Script Changes
does not trigger reload
Steps to reproduce:
- Create a scene and attach a new script file which prints something every second
- Enable
Sync Script Changes
- Change message from normal editor - Godot reloads
- Open external editor (for example VSCode) and edit it.
- The file reloads in the Godot file editor if opened, but doesn’t reload the project
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 80
- Comments: 29 (10 by maintainers)
Commits related to this issue
- fixes #10946, auto-reload with external editor — committed to yjh0502/godot by yjh0502 3 years ago
Just to have a really clear (and simple) repro: (v3.2.2.stable.official on macOS 10.15.5)
Configuring an external editor is not required to repro.
The error doesn’t seem to cause any other issues.
@ohnoimdead Please don’t bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead.
We’ve had enough confirmations of this bug (more than 5 recently), no need to keep bumping the issue.
I am getting:
core/resource.cpp:79 - Condition ' exists ' is true.
andERROR: Another resource is loaded from path: res://scripts/entity.gd (possible cyclic resource inclusion) At: core/resource.cpp:79
as soon as I save a script file with VSCode and focus Godot while the game is running. The running game is not updated with the changed script.
VSCode is properly setup as external editor in Godot’s settings.
so… is live coding with external editors not usable since 2017 (if it ever has been working) and it has been pushed to milestone 4.0? that hampers my motivations to use Godot severely as live coding is a major selling point for me.
Happy birthday bug! You are now three years old.
I’m having the same bug. All I have to do is just save the file in the external editor and then click on the godot editor and the error shows up. I’ve cloned the repo and debugged the code. I see it go into resource.cpp:78
It seems to protect resources from being loaded from two different threads I think? Shouldn’t there be an exception to the rule for when the external_editor option is true? Or some way to detect if the resource is loaded from the external editor and not give an error?
I wanted to see if I could fix it but I don’t know the code well enough and I’d probably just introduce another bug.
This is me trying multiple scripts. (plugin, root node script, child node script)
Using Godot 3.0.2.stable under linux.
I have the same issue with this error printed:
After tinkering more and reading how the wire protocol worked, I was able to make it work.
I wrote the following ruby script:
(You need the
listen
gem and ruby>2.2
)Then start the scene with:
It will not work with the editor, it will run the game by itself. But it fill my use case which is to be able to see the changes made to a script generating procedural geometry immediately. Of course it works with the built in editor, but I can’t use anything else than vim for coding:)
My situation is slightly different, I’m making an importer that translates one language to GDScript directly. Any time I click Reimport, I get the error message:
Another resource is loaded from path 'res://<file>' (possible cyclic resource inclusion).
I create a GDScript object and modify its source code, and then use ResourceSaver to save it to a gd file. Even with a
script.reload()
the error remainsTested with Godot v3.2.2 beta4
As of build 3fb9c776ff53fbdd656b648e05101eaeaa39c908, whenever I return to the editor after external script editing I usually get the error below, and have to change something and resave the script for it to reload successfully.
The stack looks like:
This as well, not sure if the linked issue is exactly related but I do have to tell users to unfocus the editor window in order for the modifications to the script to show up. Can we add a mechanism to allow plugins to invalidate the cache that represents an edited script?
I also have update issues with godot and vscode but on macos 10.15 and godot 3.2. Everything is proper installed. script syncing is enabled and I get the error message
Another resource is loaded from path 'res://levels/wall_tool.gd' (possible cyclic resource inclusion).
script only updates by restarting godot or randomly