- Notifications
You must be signed in to change notification settings - Fork 582
Description
I'm using a tab system for our app, with the middle tab (i.e. train tab) being the tab where the Unity games are supposed to be played. We have two games bundled together inside the Unity project and it's my understanding that you can't send a message to Unity before the Unity project is launched and the Unity controller is ready, which is why our business logic requires the Unity app to be launched beforehand so the user can choose between one of the two games. For that, I've been using a Stack widget with the Unity widget launching the initial scene on the background and the "Play game X" buttons on the foreground.
Everything works just fine in iOS and Android 10 (both for debug and release mode), but Android 9 in particular seems to be facing some issues. Here are some screenshots to illustrate the issue (taken from a Xiaomi Mi Note 3 with Android 9):
The loading screen is actually the initial Unity scene, which is rendering over the Flutter UI for the other two tabs. Here's how it's supposed to work (screenshots taken from a LG Velvet with Android 10):
Here's the code for the Train tab, where the Unity widget currently is:
Widget build(BuildContext context) { final TabsModel model = Provider.of<TabsModel>(context); print("model game to load on train tab " + model.gameToLoad.toString()); return Stack( fit: StackFit.expand, children: [ UnityWidget( onUnityMessage: onUnityMessage, onUnitySceneLoaded: onUnitySceneLoaded, onUnityCreated: onUnityCreated, fullscreen: false, onUnityUnloaded: () { print("unloaded"); }, ), if (model.gameToLoad.isEmpty) Positioned.fill( child: AnimatedOpacity( duration: Duration(milliseconds: 500), opacity: model.gameToLoad.isEmpty ? 1 : 0, child: Container( color: Theme.of(context).backgroundColor, child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Padding( padding: const EdgeInsets.all(48.0), child: CustomPrimaryButton( onPressed: model.gameToLoad.isEmpty ? () => loadGame( gameToLoad: 'SoundSeeker', model: model, ) : null, label: 'Play sound seeker'), ), Padding( padding: const EdgeInsets.all(48.0), child: CustomPrimaryButton( onPressed: model.gameToLoad.isEmpty ? () => loadGame( gameToLoad: 'BusyBarista', model: model, ) : null, label: 'Play busy barista'), ), ], ), ), ), ), ], ); } I can also provide some code for the tabs structure if needed.





