godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.55k stars 20.67k forks source link

Sync Script Changes Does Not Resume After Error in Code is Fixed #28111

Open BridgetNichols opened 5 years ago

BridgetNichols commented 5 years ago

Godot version: 3.1

OS/device including version: Mac OS Sierra 10.12.6

Issue description:

When sync script changes is turned on from the debug menu, it works as expected. However, if their is a bug in the code, execution is paused. This is what should happen, but afterwards execution should be resumed. Instead the user has to manually resume execution after fixing the bug. I realized this while watching GDQuest's video. I have linked to the part in the video where he explains this issue basically explaining everything I have already written.

I tried to fix this issue myself, as I feel it shouldn't be too hard to implement, but I've never contributed to a project this big, and I simply can not figure out where the code is that is doing this. If anybody might be able to point me in the right direction I might be able to try and fix this issue. Otherwise, here's a minor issue that may be worth taking a look at.

Steps to reproduce: Create a test scene and attach a script to the root node. Write a small program in the script such as:

func _process(delta):
     print("test")

Make sure that sync script changes is checked in the debug drop down menu in the top left corner of the editor, and then run the scene. Go back into the editor and create a bug in the code such as:

func _process(delta):
     print("test

This will pause execution as expected. Now fix the error in the code. Execution will not be resumed after fixing the error.

Minimal reproduction project:

Sync Script Changes Issue.zip

bojidar-bg commented 5 years ago

Does manually pressing the "continue" button allow execution to continue untroubled?

BridgetNichols commented 5 years ago

Yes it does, but I feel that it should resume automatically after the bug is fixed as sync script changes is supposed to make making script changes on the go, smooth. Having to manually press the resume button after fixing a bug, although a small task, really makes the whole process a lot less smooth.

bojidar-bg commented 5 years ago

There are two possible approaches to fixing this problem:

  1. Making the editor resume execution right after syncing changes to scripts.
  2. Do not sync scripts changes if there is a compile-time error in the script.

Here are some locations around the code which might be useful: