-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Add support for embedding game process in the Android Editor #102492
Add support for embedding game process in the Android Editor #102492
Conversation
130555a
to
4135461
Compare
f8b5412
to
9b5f5a8
Compare
I haven't reviewed the code or tested this new mode yet. However, based on the screen recording you shared, it looks like the top toolbar remains visible even when embedded mode is turned off ( while running in split-screen). I think, it would be better to disable or hide the toolbar when embedded mode is off, It takes unnecessary space. This is also inconsistent with the desktop editor, where the toolbar is disabled, and its options like camera override isn't available if embedded mode is disabled. |
I have been testing this, and I can confirm that this is indeed the case: even with embedding disabled, the toolbar still appears. I agree that it shouldn't be there in this case. UPDATE: Or, actually, then how would you change whether to embed on play or not? Because the settings for that are in the toolbar under the three vertical dots. Having those settings there is kind of awkward, because you have to actually start playing the game before you can configure how you want to play the game. |
You can change it in EditorSettings Alternatively, if user opens the "game" tab it currently displays a message to run the game, Instead we can open the "Game" tab and let user to change the "Embed on play" setting? |
A couple other things I noticed in my testing:
|
The visibility toggle button doesn't seem to work. But is can be change from inspector. Also could you make those button little smaller. Those buttons are taking lot of space. And also please remove the the round corner and the bg shadow :/ |
@llama-nl Seems like the visibility toggle is working in the recording you took.. Are you referring to something else? |
@llama-nl that's the expected behavior; the visibility toggle is for the selection box around the selected object, not for the object itself. |
I am currently testing it on my phone, and Embed mode works great! However, I’m experiencing some UI issues, which are also visible in the screen recording you shared. VID_20250207_110624.mp4As you can see, when switching to fullscreen mode, it doesn’t fully expand and leaves a margin around the borders. Additionally, the status bar becomes visible, which I assume is unintended. Another minor issue is that in PiP mode, a shadow appears around the borders. I’m not sure if this is intentional, but it seems out of place. UPDATE: As you can see in video, when switching to PiP mode and then back to Embed mode, the rounded corners become sharp. |
VID_20250207_112827.mp4Running the game with Embed mode disabled tries to launch it in split screen. While this works well for tablets, it’s not optimal for smartphones and is causing issues for me. It's currently not possible for me to run the game in fullscreen. On a regular smartphone, it should default to fullscreen mode, just like it did previously, with a button to switch to PiP mode when needed. |
76a4590
to
05aab5d
Compare
platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt
Outdated
Show resolved
Hide resolved
Everything is as expected. Just I am unable to play game in And a proposal: could you make the embed window center of the screen or a way to move the window. |
That's the expected behavior. To run the game
The ability to drag and resize the window is planned, but it requires additional work and will be added in a follow-up PR (most probably in 4.4.1). |
Ah, ok, I get that on both my phone and my tablet, even though my tablet seems unable to actually put the embedded window in PiP. So, I guess it must be some issue with my tablet.
Hm. This option works and does technically solve the problem, but having it as an editor setting makes it hard to get to or notice that it's there. My main issue with the menu bar is that it can mess up the scaling of the game by taking up that extra space. For example, here is the 2D platformer demo on my phone without the menu bar: And here it is with the menu bar: Could we maybe include this setting (and perhaps some others) in a more accessible place? Like, maybe the "Game" tab could show this setting as well as the ones about embedding and PiP, rather than just popping up the window? Or, maybe there could be some way to hide the menu bar, sliding it away like a drawer, or something like that? Then it's not a setting but just a way of interacting with it to hide/show it. |
@dsnopek I can add a button to show / hide the menu bar. That would also allow to remove the |
ba0c463
to
4f2777b
Compare
@m4gr3d I encountered another issue. When GameWindow is visible and you close the app to background and then open from recents screen it would only open Embedded Game activity, Editor would be hidden. It can be really confusing as even if you close the Embeded game, Editor window won't show until you open app from launcher again. I think possible solution would be to override the onResume method in Embedded Game activity and create an intent to show Editor. |
752cb3f
to
d6c667a
Compare
platform/android/java/editor/src/main/res/layout/godot_editor_layout.xml
Outdated
Show resolved
Hide resolved
platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt
Outdated
Show resolved
Hide resolved
c087451
to
5aae392
Compare
@dsnopek @llama-nl @syntaxerror247 All of your feedback have been addressed! Can you give the latest version a try?
@syntaxerror247 That issue should also be resolved in the latest version! |
Everything works great! 🎉 I've actually been testing and reviewing every change you pushed to make sure nothing slipped through, especially as we approach the end of beta. EDIT: Forgot to mention, the code also looks solid! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spotted a bunch of missing .
I don't mind, but @AThousandShips wouldn’t like it 😀
platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt
Outdated
Show resolved
Hide resolved
platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt
Outdated
Show resolved
Hide resolved
platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt
Outdated
Show resolved
Hide resolved
platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt
Outdated
Show resolved
Hide resolved
platform/android/java/editor/src/main/java/org/godotengine/editor/embed/GameMenuFragment.kt
Outdated
Show resolved
Hide resolved
platform/android/java/editor/src/main/java/org/godotengine/editor/embed/GameMenuFragment.kt
Outdated
Show resolved
Hide resolved
platform/android/java/editor/src/main/java/org/godotengine/editor/embed/GameMenuFragment.kt
Outdated
Show resolved
Hide resolved
platform/android/java/editor/src/main/java/org/godotengine/editor/embed/GameMenuFragment.kt
Outdated
Show resolved
Hide resolved
platform/android/java/lib/src/org/godotengine/godot/utils/GameMenuUtils.kt
Outdated
Show resolved
Hide resolved
Wow, now everything is perfect. Really grate work |
- Implement Android editor specific `EmbeddedGodotGame` to support embedding the game window in the Android editor
5aae392
to
7495a8a
Compare
I just tested this, and it works great! Could we have it even when in embedded mode? Because then I really don't think I'd have a reason to not use embedded mode, especially if the menu bar started out hidden. Like 99% of the time, I don't think I'd want to use the buttons on the menu bar and just want to test the game, so it makes more sense to me to have it hidden and then show it, rather than the other way around. I know it's shown by default on other platforms, but on mobile screen space is more precious. Anyway, that's not worth getting hung up on now. :-) I haven't reviewed the code very deeply, but overall this is working great in my testing! |
Thanks! |
Follow up to #97257 and #99010, this PR implements game embedding for the Android editor.
Screen_Recording_20250206_095310.mp4
Due to differences in platform capabilities, the Android implementation uses a custom floating window, implemented using Android views, which replaces the Game workspace view seen on other platforms; i.e: when embedded, the game view on Android is always floating.
The implementation also leverages Android picture-in-picture support (which was added in #95700) to allow the game view to remain on top (when enabled) while users interact with the editor.
Screen_Recording_20250206_095758.mp4
Note:
run/window_placement/play_window_pip_mode
editor setting has been removed, instead PiP can be explicitly triggered when running in non-embedded mode, or is implicitly used in embedded mode whenKeep on Top using PiP
is enabled.Screen_Recording_20250206_100359.mp4
Things missing
Limitations
Closes godotengine/godot-proposals#10884
Bugsquad edit, closes: godotengine/godot-proposals#11309