-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter 3.19 breaks Unitywidget on Android 12+ screen transition, resize, screen rotation or keyboard open. #929
Comments
Is the third workaround "use According to this issue (and two more related ones) this mode introduces more issues than working around, right? As of now, what is the best setup for using Flutter with Unity and the widget and avoid rendering or touch input issues? Probably Flutter 3.13.9 + Unity with old input system ? |
[UPDATE] the upsides list below is outdated as of Flutter 3.22, in which the visibility and rotation issues are fixed when using useAndroidViewSurface: false. Regarding Downsides:
Upsides:
With these new issues popping up, the downsides are getting more and more acceptable. I still prefer to stick with <= 3.13.9. |
Glad I found this.. I was trying to work out why unity wasn't working at all on android 12+. Not just on resize - at all.. Downgrading flutter just not an option for us, we have functionality that relies on 3.19 Setting useAndroidViewSurface true fixed it and as far as I can see we haven't hit any downsides, it works just the same as before. |
Fixes for this are included in Flutter 3.22 |
Thanks for the update! Do you have any update regarding your previous comment and recommendation on which version/setup should be used with which up-/downsides? |
@hdeppert Most upsides listed above are now negated in flutter 3.22. Handling touch with the new input system is now the main difference, but it can be made to work in Virtual display too #938. |
Description
Just a warning about using Flutter 3.19 on Android 12+.
The Unitywidget will break when a keyboard is openend or the screen is rotated.
It will end up spamming the following error:
You can only recover from this by fully removing the UnityWidget from the widget tree.
This does not happen on Android 11 and lower.
The Flutter 3.20 beta and master channel fix this bug, but that introduces another Unity bug.
Flutter now resizes the platform view and Unity can't seem to handle that. It will resize to the wrong size.
Workarounds
[UPDATE] Flutter 3.22 fixes the issue and can be used without workaround.
You've got 4 choices for now:
useAndroidViewSurface: true
Video
The red color is a container behind the unitywidget, to show when it is transparent or invisible.
The 3.19 videos were recorded on an earlier beta, but you get the same visual result on 3.19 stable.
S20FE Keyboard open videos
S20FE_3.16_keyboard.mp4
S20FE_3.19_keyboard.mp4
S20FE_master_keyboard.mp4
Screen rotation videos
S20FE_3.16_rotate.mp4
S20FE_3.19_rotate.mp4
S20FE_master_rotate.mp4
Versions
The text was updated successfully, but these errors were encountered: