Open ghsoares opened 3 years ago
This slows down the workflow when testing and calibrating variables, for example.
Remember that Godot supports live editing, which lets you edit a node's properties in your local editor while seeing the changes in the running project. Changes will be kept after the project is closed. Editor -> project camera replication is also available by clicking the camera icon at the top of the 2D/3D editor viewport while the project is running.
If you don't want to keep changes after closing the project, go to the Remote scene tree dock while the project is running and adjust properties there.
@Calinou There's some problems with live editing with C# in Godot:
So the live editing tool would only be useful to set some variables like player speed or to do small changes to a scene that doesn't break or crash the running scene.
When running the project, there's a huge performance impact in other tasks, making it almost impossible to work in a external editor on lower-end devices;
This would be resolved by https://github.com/godotengine/godot-proposals/issues/2001, but in the meantime, you can use a script to implement the same functionality.
When running the project, there's a huge performance impact in other tasks, making it almost impossible to work in a external editor on lower-end devices;
This would be resolved by #2001, but in the meantime, you can use a script to implement the same functionality.
Still I think that live editing is not being useful for C#, it's really useful when using with gdscript because it don't need to compile and is deployed almost immediately, but with C# I need to compile first, freezing the running scene and the editor and just after the project is compiled, my game crashes.
I need this too! It would be so much better to just start the game instead of having to recompile it every time
@DasOhmoff Please don't bump issues without contributing significant new information. Use the :+1: reaction button on the first post instead.
@Calinou Do you know whether or not Godot supports hot-reloading C# script changes? It doesn't seem to in my experience, but if it's supposed to, I'd like to know how to get it to.
@Calinou Do you know whether or not Godot supports hot-reloading C# script changes? It doesn't seem to in my experience, but if it's supposed to, I'd like to know how to get it to.
I don't think support for live C# reloading is implemented. Only GDScript supports live reloading, and it has many quirks in its implementation already.
I'm meeting this problem too. In my computer, build C# will take some time. maybe can add option setting for disable auto build C# when run a scene. in my project, most time i'm only edit GDS, not edit C#, if i want, i can click the build button
I was tired of having a new compilation occur every time I wanted to try the game, even if no C# code was modified. Additionally, I usually build directly from Visual Studio because it's faster than building in Godot (I think it's due to incremental builds or having dotnet.exe in memory, but I'm not exactly sure).
I created a little workaround: I unbound the mapping to run the game in the editor and created a small addon to start the game in debug mode:
public override void _Input(InputEvent e)
{
if (e is InputEventKey ie && ie.IsPressed())
{
if (ie.Keycode == Key.F5)
{
EditorInterface.Singleton.SaveAllScenes();
ProcessStartInfo ps = new ProcessStartInfo();
ps.FileName = OS.GetExecutablePath();
//Add "--remote-debug tcp://127.0.0.1:6007" for remote debugging
ps.Arguments = "--path .";
ps.WorkingDirectory = ProjectSettings.GlobalizePath("res://");
Process.Start(ps);
}
}
}
This solution is not perfect because sometimes I forget to rebuild after modifications, and I need to build manually.
I believe it would save a lot of time for C# developers if a check was added to see if a build is needed before starting the game.
It's probably easy to implement now that Godot has this warning:
I could try to implement it if there is some interest?
I personally don't need live reload (and is way beyond my skillset), I usually run the project from Visual Studio and use the "Edit and Continue" which works usually nicely for some quick fix while debugging.
Describe the project you are working on
A 2D Space Game
Describe the problem or limitation you are having in your project
In the mono version of Godot, all the .cs scripts must be compiled in the project. The problem is that Godot compiles the project every time I run a scene, even if no script has changed. This slows down the workflow when testing and calibrating variables, for example.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Let Godot build the project only when a script modification has occurred, this verification can be made every time the user focus the engine windows.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
There's some libraries for C++ that can be used to watch a file. So when a script file is created, the file is watched, and when the engine window is focused, the watcher is querried for a file change, if is true, then the project is compiled.
If this enhancement will not be used often, can it be worked around with a few lines of script?
No without changing the core of the engine.
Is there a reason why this should be core and not an add-on in the asset library?
Because there isn't any way to change when a project is compiled without modifiyng the source code.