-
-
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
Script changes made with an external editor are not live reloading #73808
Comments
Also just tested this in 4.0 rc3, and it doesn't work either. That said, I'm just not 100% sure how/if it's supposed to work. I found a setting Auto Reload Scripts On External Change in both 3.5 and 4.0, but turning it off doesn't seem to help (nor would I expect it to, I guess). |
Took some time to test this on a Windows 10 machine - same behaviour. Makes me wonder even more if this is even supposed to work. |
Doesn't appear to be a regression either - just tested in 3.4.2, the release that first included this change, as well as my own build of 19301d4 (the commit that fixed this in the 3.x branch) - no luck. Started to look into the code to try and figure out what's going on here - currently trying to understand all the cases in which |
Alright, from reading the code, I think I figured it out! The changes are only reloaded if the editor receives focus after the changes are saved. Looks like that's the behaviour as implemented, but I would argue it would be more ideal if it wasn't necessary to change focus to the editor first. |
What's the use for automatic reload? |
My use-case is that I have multiple monitors. I have VS Code open on my left monitor, the editor on my middle monitor, and the running game on the right monitor. Since I can still see the game running ideally I'd like to see my changes reflected as soon as I save. (Which is how it works if I use the built-in script editor.) |
I'm seeing the same behavior on Linux in 4.0.stable (GDScript version). |
It would be great to fix this. The editor is going to be NOT focused 100% of the time when you are editing code with an external editor, which you need to be doing if you want to see your code side by side with the scene editor. |
On Godot 3.5.3, Windows 10: It works fine if I edit the script from within Godot -- changes apply in a running game immediately. I've tried with and without Editor > Text Editor > External checked. |
The fix was implemented here #82986. It does seem to work in |
I'm using 4.2.2.stable and this is not working yet. I did all the required setup but when I save a script in Vscode, the running game is not reloading. |
Well according to the comment above, it does work in 4.2.1, so it should in 4.2.2 too. |
I was testing right now and it does seem to work in some cases, e.g. I made some changes to the |
|
Okay, so, if I make changes in |
More precisely - the changes are applied, but you need to restart the scene or add a new instance of the node to call the method again. You can also use |
@gmanavarro @KoBeWi I have the same use case, I'm hoping if we get this ticket resolved #47615 (comment) then the workflow can be: For scripts that I want to edit at runtime and have their this is how the PlayCanvas engine does it and I think it works pretty well. Gives you full control over how to update things at runtime. See for reference: https://developer.playcanvas.com/user-manual/scripting/hot-reloading/ |
I think I am seeing the same issue, but I'm not sure because I'm using gdscript and some of the bug reports linked in this thread concern C#: If I run the game from VSCode, hot reloading by editing the script in VSCode does not work. If I run the game from the editor, hot reloading by editing the script in VSCode does work. However, when the game is run from the editor, the debugging tools in VSCode do not work. I've written this up in a forum thread here. I would like to both hot reload and use debugging from VSCode. I have tried this on both 4.2.2 and 4.3 rc-1 with a new project by putting the icon into a scene and changing its position in _process. The changes do appear when I restart the game. |
This may be related, I've noticed that whether hot reload works, using VS Code, depends on whether you specify the debugger and debug server/adapter in Here is my writeup in a similar issue thread for the godot-tools plugin: godotengine/godot-vscode-plugin#336 (comment) |
Yes, this is the expected behavior. Additionally, using the |
Godot version
3.51.stable.mono.official
System information
Ubuntu 22.04.2 LTS, GLES3, GeForce RTX 3090
Issue description
Live reloading changes made by an external editor doesn't seem to work for me, tried this on two different machines. In my understanding, since #51828 (which aims to address #10946) has been merged quite a while ago, it should.
I don't see any errors in the console or debugger, just nothing happens after I save the file with an external editor. I tried it with and without setting Use External Editor.
Update: Did some debugging (full story in the comments) and figured out that it does reload, but only if the editor window is focused after the file has been saved. I'd love a truly automatic reload though, without having to touch the editor first.
Steps to reproduce
I made a project to reproduce this, but it's pretty simple:
_process
function with$Label.text = "Test"
Steps to reproduce once the project is in place:
"Test"
to something else in the Godot script editor and observe that it live reloadsMinimal reproduction project
external-editor-live-reload.zip
The text was updated successfully, but these errors were encountered: