godot-kotlin-jvm icon indicating copy to clipboard operation
godot-kotlin-jvm copied to clipboard

Hot reload/swap in running scene

Open LukasVykuka opened this issue 1 year ago • 4 comments

Is it possible to make hot reload of just builded code to running scene? Or is it possible to re-launch current scene after build in IntelliJ? This would improve workflow.

LukasVykuka avatar Dec 29 '23 12:12 LukasVykuka

We never tried, but I think it should be possible as long as you don't make any structural changes to the code and only modify function bodies. The process should be the same as any JVM program, you will simply need to attach your IDE to the JVM Godot is using. For that you can launch Godot with the --wait-for-debugger argument. https://godot-kotl.in/en/stable/user-guide/advanced/commandline-args/

One issue I see is that running a scene from the editor directly won't allow that, as it's technically a separate Godot instance launched without arguments. I guess we could add some settings to allow that, but first we will have to test if hot reload works outside the editor.

CedNaru avatar Dec 29 '23 12:12 CedNaru

One issue I see is that running a scene from the editor directly won't allow that, as it's technically a separate Godot instance launched without arguments. I guess we could add some settings to allow that, but first we will have to test if hot reload works outside the editor.

What about another launch arguments for editor which will be passed to JVM running the scene? It can be then also used for passing debugger address and port for attaching remote debugger to scene runned from editor.

LukasVykuka avatar Dec 29 '23 12:12 LukasVykuka

You mean having a duplicate of existing debug arguments but for scene we start from editor ?

piiertho avatar Dec 29 '23 13:12 piiertho

You mean having a duplicate of existing debug arguments but for scene we start from editor ?

Yes, exactly.

LukasVykuka avatar Dec 29 '23 13:12 LukasVykuka