Skip to content

Conversation

@Daylily-Zeleen
Copy link
Contributor

@Daylily-Zeleen Daylily-Zeleen commented Dec 27, 2025

Now we can modify, compile and focus in godot editor to trigger hot-reloading in debug process like GDScript.

NOTE: Callable that created by Callable.create() can't be reloaded.


Edit:

1766997122578.mp4

Test project:

ts-reload-test.zip

@Daylily-Zeleen Daylily-Zeleen marked this pull request as draft December 27, 2025 20:57
@Daylily-Zeleen Daylily-Zeleen force-pushed the daylily-zeleen/implement-reload_scripts-for-debugging branch from f784cde to 499c610 Compare December 28, 2025 05:20
@Daylily-Zeleen Daylily-Zeleen marked this pull request as ready for review December 28, 2025 05:36
@Daylily-Zeleen Daylily-Zeleen force-pushed the daylily-zeleen/implement-reload_scripts-for-debugging branch 2 times, most recently from 45d8e74 to 1d860c3 Compare December 28, 2025 17:22
@nmerget
Copy link
Contributor

nmerget commented Dec 28, 2025

@Daylily-Zeleen I tried to test the branch, how to trigger the hot-loading? With --verbose flag and then export a web build? Or am I able to start the scene directly?

@Daylily-Zeleen
Copy link
Contributor Author

Daylily-Zeleen commented Dec 28, 2025

@Daylily-Zeleen I tried to test the branch, how to trigger the hot-loading? With --verbose flag and then export a web build? Or am I able to start the scene directly?

  1. Run godot editor.
  2. Enable auto compilation.
  3. Create a scene with a script for test:
    For example, print a simple text "1" in _process().
  4. Run this scene.
  5. Modify the script (like change "1" to "2"), after compiling, give focus to godot editor window to trigger reloading.
  6. Check "output" panel.

Edit: modify TypeScript and save it in godot ediot can not test this pr,because reloading is triggered before compiling. Please use external text editor for test.

@nmerget
Copy link
Contributor

nmerget commented Dec 28, 2025

Bildschirmaufnahme.2025-12-29.000654.mp4

Somehow it's not working. I used your branch, and followed your steps

@Daylily-Zeleen
Copy link
Contributor Author

Bildschirmaufnahme.2025-12-29.000654.mp4
Somehow it's not working. I used your branch, and followed your steps

The output is too frequent and hard to check change. Please test again by my test project.
I uploaded test project and add demonstration video to the first comment.

@Benjamin-Dobell
Copy link
Member

What happens when JS references are held to these script objects that have been reloaded? Won't the prototypes be stale and not match the implementations anymore?

Maybe I'm just misunderstanding what you're doing here.

@Daylily-Zeleen
Copy link
Contributor Author

Daylily-Zeleen commented Dec 29, 2025

I'm not sure, this main purpose of this pr is receiving debugger message from editor to reloading changed scripts, then restore instances state.
The actual reload behavior is GodotJSScript::reload().

@Benjamin-Dobell
Copy link
Member

Ah right, yeah, I suspect it's pretty broken at the moment. I'm planning on doing some work in this area in the coming weeks. I'm not sure it'll currently behave as users expect if we merge this right now, but it does look like a decent starting point. Thanks for sharing your work on this.

@nmerget
Copy link
Contributor

nmerget commented Dec 29, 2025

Bildschirmaufnahme.2025-12-29.000654.mp4
Somehow it's not working. I used your branch, and followed your steps

The output is too frequent and hard to check change. Please test again by my test project. I uploaded test project and add demonstration video to the first comment.

You project works as exprected.

I tested it with this file and modified it with _process, but it didn't work.

Maybe the problem is the autoload script? That's the only thing about the projects which might differ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants