Black screen on background of transparent activity in unity

Hi all,

I am working on a plugin that requires to move to a new Android Activity (native Activity or FragmentActivity) from main activity (that is extended from UnityPlayerActivity). The new activity has a transparent background so that the scene of unity game can be seen at the background but when new activity opens the background goes black instead of being transparent. Please help me on this as soon as possible.

Hi did you get any information on this?

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);
}

1 Like