Skip to content

Flutter 3.19 breaks Unitywidget on Android 12+ screen transition, resize, screen rotation or keyboard open. #929

Open
@timbotimbo

Description

@timbotimbo

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:

E/BufferQueueProducer(17453): [ImageReader-1080x2000f22m4-17453-17](id:442d0000001b,api:1,p:1104,c:17453) dequeueBuffer: BufferQueue has been abandoned

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:

  • use Flutter up to 3.13.9
  • Use Flutter Up to 3.16.9 (with bug on Android < 8)
  • use useAndroidViewSurface: true
  • use 3.20 beta and don't use rotation or keyboard

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

1: 3.162: 3.193: master (3.20)
S20FE_3.16_keyboard.mp4
S20FE_3.19_keyboard.mp4
S20FE_master_keyboard.mp4

Screen rotation videos

4: 3.165: 3.196: master (3.20)
S20FE_3.16_rotate.mp4
S20FE_3.19_rotate.mp4
S20FE_master_rotate.mp4

Versions

  • Unity: This applies to all Unity versions
  • Flutter: 3.19 stable
  • Android: Android 12 and up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Flutter issue/bugProblem caused by Flutte that we can't fixUnity issue/bugProblem caused by Unity that we can't fix on our end.androidThis issue is specific to the Android Platform.bugThis issue refers to a bug in the plugin

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions