Description
Describe the project you are working on:
Enable the ability to embed Godot as a subview within an Android application.
Describe the problem or limitation you are having in your project:
As of version 3.2.2, the Godot Android architecture is based off the Android FragmentActivity
component. Since an Android application typically only has a single Activity
active at a time (especially since ActivityGroup
was deprecated), with the Activity
's view driving the entire screen display , this results in the inability to embed Godot as a subcomponent within an Android application.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
The goal of this proposal is to update the Godot Android architecture to support using Godot as a subcomponent.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
The entry point for Godot apps on Android is the Godot.java
class. The class extends FragmentActivity
in order to hook into the Activity
lifecycle which enables to update the app's screen display via setContentView
and propagate key lifecycle callbacks to the Godot Engine.
As such, we need an alternative that provides the ability to update the screen's display while also providing the Godot Engine with the expected Android lifecycle callbacks, and that is modular and can be combined with other components in a single activity.
Based on these requirements, Android Fragments
appear to be the best tool for the job, and will be used as the basis for this work.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
This affects the architecture for Godot Android apps, and thus cannot be worked around via scripting logic.
Is there a reason why this should be core and not an add-on in the asset library?:
This affects the architecture for Godot Android apps, and thus cannot be provided via scripts and/or plugins.
Activity