juicycleff / flutter-unity-view-widget

Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demo
BSD 3-Clause "New" or "Revised" License
2.09k stars 505 forks source link

White screen issue #902

Open Kiruthika2206 opened 7 months ago

Kiruthika2206 commented 7 months ago

Facing white screen issue while navigating to other screens and whenever we are going and coming back to the application.

Unity version 2021.3.11f1 Flutter version 3.3.10 fuw-2022.1.7f1.unitypackage

emileswain commented 3 months ago

Flutter 3.19.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 7482962148 (2 weeks ago) • 2024-02-27 16:51:22 -0500 Engine • revision 04817c99c9 Tools • Dart 3.3.0 • DevTools 2.31.1

I found i had the same issue when navigating between views. This is different from the flickering you get, which was solved by setting the MaterialPage Route transition duration to 0.

The white screen occurs a bit randomly, sometime the first view will load and display the unity scene, and the second page will be blank. Sometimes its the other way around, The first screen will be white and the second view will load. Going backand forth shows that one view works and the other doesn.t

I solved this by setting useAndroidViewSurface: true If i set this to false i get this issue even now.

I might add that when i get the white screen, i know the unity scene is runnig, because i can see the logs from a coroutine.

timbotimbo commented 3 months ago

@emileswain your issue has a different cause.
Flutter 3.19 simply breaks the unitywidget if useAndroidViewSurface: false.

https://github.com/juicycleff/flutter-unity-view-widget/issues/929

This is fixed on the flutter master branch, so it might be in 3.21 or whatever version number that gets.

emileswain commented 3 months ago

cool, thanks.