flame icon indicating copy to clipboard operation
flame copied to clipboard

game.pauseEngine causes UI jank

Open Hwan-seok opened this issue 3 years ago • 0 comments

Thanks for developing the great engine :). I asked this quite before on discord and thankfully @spydon helped and gave instructions to open issue.

Current bug behaviour

game.pauseEngine . game.resumeEngine causing the UI jank.

I pause engine when didPushNext and resume it when didPopNext because of the performance(battery consumption). But both causes UI janks on Android and IOS. The jank is more stands out especially on Android phones(among I tested) and pausing engine.

@override
void  didPushNext() {
	GameManager.use.pauseEngine();
	super.didPushNext();
}

@override
void  didPopNext() {
	GameManager.use.resumeEngine(),
	super.didPopNext();
}

After remove the Pause/Resume engine inside didPushNext and the didPopNext, the UI jank dissapears. You can see the video at more infomation section below

Expected behaviour

No UI janks when pausing engine.

Flutter doctor output


[✓] Flutter (Channel stable, 2.10.3, on macOS 12.1 21C52 darwin-arm, locale ko-KR)
    • Flutter version 2.10.3 at /Users/lafity101/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (2 weeks ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/lafity101/Library/Android/sdk
    • Platform android-32, build-tools 32.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.65.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.36.0

[✓] Connected device (3 available)
    • SM G986N (mobile)           • DEVICE_ID               • android-arm64  • Android 11 (API 30)
    • 라피티의 iPhone 12mini (mobile) • DEVICE_ID • ios            • iOS 14.8 18H17
    • Chrome (web)                • chrome                    • web-javascript • Google Chrome 99.0.4844.74

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

More environment information

flame: ^1.1.0-releasecandidate.5
flame_tiled: ^1.3.0-releasecandidate.5
tiled: ^0.8.0

More information

With pause/resume engine

https://user-images.githubusercontent.com/38072762/158755614-df9e5a14-556b-4ca2-84fe-2dcbe309d80a.mp4

Without pause/resume engine

https://user-images.githubusercontent.com/38072762/158755633-ec6ad5bb-8ee4-43c2-acf2-e015d69d94d8.mp4

Hwan-seok avatar Mar 17 '22 07:03 Hwan-seok