Skip to content
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

Android editor freezes after script error in project due to not switching to the editor view automatically #77966

Open
Silentcody52 opened this issue Jun 7, 2023 · 15 comments · Fixed by #95700

Comments

@Silentcody52
Copy link

Godot version

Mobile Editor 3.6.beta.2 android

System information

I am on a samsung a04s android 11

Issue description

When you run a piece of code that has a error in it in the mobile version of godot the scene becomes black and it also does not let you leave the scene the only way to go back is by manualy leaveing the app i havd no idea what causes this or how to fix it but it would be nice if you would i have also provided a little demostration down below kind regards

: random poor kid

Steps to reproduce

Go into godot type a error and run it should brick the entire thing

Minimal reproduction project

Screenshot_20230607-172012_Godot Editor 3
Screenshot_20230607-172021_Godot Editor 3

@lawnjelly
Copy link
Member

I also got this behaviour when I tested the example code. @m4gr3d

@Booklight12
Copy link

I think the normal logic would be something like this: There is a problem -> Go back to the engine edit page and display the error message and memory information. Just like on the computer side

@ZishAan23
Copy link

ZishAan23 commented Sep 26, 2023

I am also facing the same problem. Is godot going to fix this bug anytime soon?
There might be many users who want to use Godot but might be leaving it because of this error. @m4gr3d pls try to fix this 🙏

@m4gr3d
Copy link
Contributor

m4gr3d commented Nov 3, 2023

The issue occurs because the gdscript error causes the Godot debugger to freeze the running project until it's resumed.
This is not visible on a phone because the limited screen estate prevents seeing both the editor and the running project at the same time, but the behavior can be observed on a tablet as shown in the recording below.

Screen_Recording_20231103_095619_Godot.Editor.4.dev.mp4

A simple fix would be to have an option to disable that behavior from the debugger.
@lawnjelly @Calinou Do you know if such an option already exists?

@Calinou

This comment was marked as outdated.

@m4gr3d
Copy link
Contributor

m4gr3d commented Nov 15, 2023

Thanks for the report! Consolidating in #77272, as this is due to the same cause.

@Calinou I'd rather consolidate #77272 into this issue since this one has more information.
I'll close the other one and reopen this one instead.

A simple fix would be to have an option to disable that behavior from the debugger.
@lawnjelly @Calinou Do you know if such an option already exists

Btw, do you know if we already have the option to disable the described behavior from the debugger?

@akien-mga
Copy link
Member

A simple fix would be to have an option to disable that behavior from the debugger.
@lawnjelly @Calinou Do you know if such an option already exists

Btw, do you know if we already have the option to disable the described behavior from the debugger?

I don't think so, but I'd suggest starting to look at the breaked signal callback which is sent to the script editor by the debugger.

It seems to have some logic to bypass some stuff if using an external editor, maybe that could help inspire a fix:

void ScriptEditor::_breaked(bool p_breaked, bool p_can_debug) {
	if (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) {
		return;
	}

	debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_NEXT), !(p_breaked && p_can_debug));
	debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_STEP), !(p_breaked && p_can_debug));
	debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_BREAK), p_breaked);
	debug_menu->get_popup()->set_item_disabled(debug_menu->get_popup()->get_item_index(DEBUG_CONTINUE), !p_breaked);

	for (int i = 0; i < tab_container->get_child_count(); i++) {
		ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i));
		if (!se) {
			continue;
		}

		se->set_debugger_active(p_breaked);
	}
}

But I'm not sure that would be sufficient.

@ZishAan23
Copy link

Is this error fixed in the new updates ? If not then is there any way to fix this from inside the Godot editor or we have to suffer this until it gets fixed. It has been 6 months since i wanted to use Godot on android but this error is not letting me use it. Whenever there is an error in the code then the editor should return me to the debugger and tell me what the error is but nothing happens. I am stuck in the main game window. Pls anyone fix this faast

@lawnjelly
Copy link
Member

As far as I can see the correct fix is for the focus to change from the running app to the editor when a bug is found, and back again when rerunning.

But maybe there are reasons why this is not simple / possible, maybe @m4gr3d can explain, most of us will know next to nothing about swapping processes on Android. 😊

@ZishAan23

This comment was marked as off-topic.

@Calinou Calinou changed the title Godot mobile editor crash after error Android editor freezes after script error in project due to not switching to the editor view automatically Feb 7, 2024
@lawnjelly lawnjelly removed this from the 3.x milestone Aug 21, 2024
@lawnjelly lawnjelly added this to the 3.6 milestone Aug 21, 2024
@lawnjelly
Copy link
Member

lawnjelly commented Aug 21, 2024

OK when I set editor/run/window_placement to side by side, I no longer have inoperable at script error.
Instead the screen is split into two with the editor short in portrait on the left, but the mouse still works (just can't get to the parts to stop the running project from the debug menu).

It looks like one key problem is that the back button is disabled, this presumably would be better used to to be able to quit the debug session (in this situation at least, when the debugger is active).

Really we want to minimize the running debug app, and maximize the editor for debugging.

@lawnjelly
Copy link
Member

Still the major bug preventing use of the Android Editor in 3.x so re-opening.

When last discussed @m4gr3d suggested discontinuing support for Android Editor in 3.x, but should be left open in case we can find some resolution.

Also probably the same issue as:
#94159
#86005

@m4gr3d
Copy link
Contributor

m4gr3d commented Oct 17, 2024

@lawnjelly Now that GodotCon is over, and if there are no further objections, I can take a look at discontinuing support for the Android editor in 3.x.

@m4gr3d
Copy link
Contributor

m4gr3d commented Oct 17, 2024

I've just unpublished the 3.x version, which means that new users cannot find and install it, although existing users can still find it.

I think that should be sufficient for the time being, and this still gives us the option of re-publishing this version of the editor if we want.

@m4gr3d
Copy link
Contributor

m4gr3d commented Oct 17, 2024

@lawnjelly Note that regarding this issue, I believe both #95700 and the upcoming #97257 mitigate it for 4.x, the issue being able to backport either of them for 3.x.

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

Successfully merging a pull request may close this issue.

7 participants