-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
External script editing does not trigger reload of running game #10946
Comments
Do you see |
cc @reduz |
@neikeq can confirm that I get an error message using a recent custom build
|
Looks like this was fixed recently, no idea by whom. Can you confirm it? |
@neikeq could you or anyone confirm? |
It doesn't happen for me anymore. Not sure about @DjPale |
I can reproduce this once again... It also happens when renaming a script that is attached to the root node (didn't test with its children) of an instanced scene. |
Using Godot 3.0.2.stable under linux. I have the same issue with this error printed:
|
As this is a blocker for me, I'm trying to workaround the issue by sending "reload_scripts" to the remote debugger, I tried to marshall the command to make it decodable by Line 87 in 34c988c
|
After tinkering more and reading how the wire protocol worked, I was able to make it work. I wrote the following ruby script: require 'socket'
require 'listen'
cmd = "\x20\x00\x00\x00\x13\x00\x00\x00\x01\x00\x00\x00\x04\x00\x00\x00\x0e\x00\x00\x00reload_scripts\x00\x00"
server = TCPServer.open 6008
puts "Listening on port 6008"
loop do
client = server.accept
listener = Listen.to('scripts') do |modified|
if modified
puts "File modified: #{modified}"
client.write(cmd)
end
end
listener.start
# Read content to avoid using kernel memory
while line = client.recv(1024)
next if line.length < 10
# Debug data packets
#puts "###"
#puts line.each_byte.map { |b| b.to_s(16).rjust(2, '0') }.join(':')
end
end (You need the 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:) |
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)
|
I think the source for this bug is here: https://github.com/godotengine/godot/blob/master/editor/plugins/script_text_editor.cpp#L579 The variable script is the one that is already cached and use the path for the script. Then, we try to reload it but it fails because the one we want to update is already cached. I tried removing script from ResourceCache before loading the edited script (rel_script) and then re-placing script in the cache (and removing rel_script from it) but this does not seem to apply script modifications as wanted. |
I am getting: as soon as I save a script file with VSCode and focus Godot while the game is running. 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. |
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 |
Related to: Rybadour/NodeConnectorGodot#3 this plugin modifies the script and the user needs to close/open godot to see changes godot plz fix! |
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? |
can't live edit on Atom and VS code as well on Mac os(10.14.6) in godot 2.21, 2.2, get this error all the time: |
Same! Bump! VSCode
|
Im using linux debian, and i have the same problem, i never use it so i just realized that it works on the builtin editor. i believe my error is the same as all linux users:
|
We've had enough confirmations of this bug (more than 5 recently), no need to keep bumping the issue. |
Sorry to bump this as well, but given that my workflow is a bit
different, I'd like to understand how this is intended to work.
Is the intent that, if I run my game from the editor, modifying scripts
in an external editor like VSCode should trigger a reload in the game
itself?
If so, is there any way to get this functionality outside of running in
the editor? I.e. a command line flag of some sort?
Thanks.
|
@ndarilek you can turn off external editor, then open any script in godot code editor, then turn on external VC code editor. When you make any changes in VSc, open godot code editor and save file. That will update code in live. |
As of build 3fb9c77, 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:
|
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: I create a GDScript object and modify its source code, and then use ResourceSaver to save it to a gd file. Even with a Tested with Godot v3.2.2 beta4 |
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. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
To fix, open the project, go to Project -> Tools -> C# -> Generate |
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 reloadSteps to reproduce:
Sync Script Changes
The text was updated successfully, but these errors were encountered: