- Home /
Android and Unity - creating a transparent Activity
Hi,
I'm developing an app that uses Unity in Android.
I start one activity from another (with start activity for result) and want it to be transparent, so that I can perform gestures on the activity on top, but be able to see the one underneath.
In Android I managed to do this by adding a style to my manifest, which makes the activity transparent, however, when using the same thing in Unity, the result is that I have a black screen.
Please advise on how to make a transparent activity work on top of another one.
Thanks in advance. Apapus.
This is a great question... 4 years later still no answer
Answer by immathan93 · Jul 20, 2016 at 02:22 PM
Unity Engine purposefully adds DimAmount to the Window
when a new activity is created, So we need to make it transparent after the onCreate of the activity.
For example,
protected void onCreate(Bundle savedInstanceState) {
Window window = getWindow();
window.setDimAmount(0); //Making the window dim transparent
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
}