Unity Android integration with native UI
1. What happened
Hi Unity folks,
we've been integrating Unity 3D views as a part of bigger applications on many platforms for years now (WebGL, iOS, Android and even Flash before ;).
Unity allowed us to put native UI on top of its view and realize interactions like drag'n'drop, etc.
Since Unity 5.6 we were not able to put native UI on top anymore. Buttons still seem to react but are not visible at all. Only sometimes, for a split second, if you switch tasks.
2. How we can reproduce it using the example you attached
I attached an (almost) empty Unity project that I exported once with Unity 5.5 and once with 5.6 (via gradle export). The other folder I attached (AndroidProjects) contains Android Studio Projects that integrate Unity and put a green bar on the bottom of the screen on top of it (just like we do in our actual project).
The 5.5 export seems to work, the 5.6 not anymore.
Details:
We have a single activity architecture where our activity extends UnityPlayerActivity.
A few of our fragments are embedding Unity as a view container.
For example:
<RelativeLayout>
<Framelayout android:id="@+id/container_unity"/>
<View android:id="@+id/anotherview1"/>
<View android:id="@+id/anotherview2"/>
</RelativeLayout>
With Unity 5.5 the other views were on top of the Unity view which made it possible to create native controls.
With Unity 5.6 the unity view is always on top of the other views, which means the native controls are gone.
It's not possible for us to just change the height of the Unity view to fix this problem since the controls are everywhere and not just at the bottom of the screen. We tried to reorder the views with .bringToFront() but Unity still stays on top of the others.
There seems to be a related issue, which unfortunately was closed "by design" without further explaination:
https://issuetracker.unity3d.com/issues/gradle-build-with-ui-elements-added-inside-android-studio-are-not-drawn
We would like to know if there is a(n alternative) solution for putting native UI elements on top of Unity on Android now or in future releases?
I want to emphasize that this is a mission critical feature for us. If you are not able to provide a solution we have to stick with 5.5 (for now) and we will be forced to abandon Unity. We sincerely hope that we can figure out a fix.
Best regards,
Andreas Atteneder
License type: Pro