-
-
Notifications
You must be signed in to change notification settings - Fork 905
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
Flame isn't Rendering Sprites #2771
Comments
That's very strange, can you try if the same thing is happening on 1.8.2? |
@spydon Yes I think it's okay in 1.8.2 👍 |
If you set |
@spydon No, I don't think so. I think that's fixed it... |
@adil192 could you have a look at that? :) |
@hilmiyafia Are you calling pauseEngine and resumeEngine in your code? |
@spydon Are we able to add extra logging to flame for this? |
@adil192 No I'm not. You can find my code above 👍 |
We don't release versions with logging if that is what you meant? But it shouldn't be hard to reproduce this if you have a physical android device and then just add some local logging where needed. |
I can't reproduce this issue on my phone. adilh@DESKTOP-M5JKVNO MINGW64 ~/Documents/GitHub/flame_2771
$ flutter doctor -v
[✓] Flutter (Channel stable, 3.13.4, on Microsoft Windows [Version 10.0.22621.2283], locale en-GB)
• Flutter version 3.13.4 on channel stable at C:\dev\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 367f9ea16b (13 days ago), 2023-09-12 23:27:53 -0500
• Engine revision 9064459a8b
• Dart version 3.1.2
• DevTools version 2.25.0
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\adilh\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Users\adilh\AppData\Local\Programs\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• CHROME_EXECUTABLE = C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.1)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.7.34009.444
• Windows 10 SDK version 10.0.22621.0
[✓] Android Studio (version 2022.3)
• Android Studio at C:\Users\adilh\AppData\Local\Programs\Android Studio
• 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 17.0.6+0-b2043.56-10027231)
[✓] VS Code (version 1.82.2)
• VS Code at C:\Users\adilh\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.72.0
[✓] Connected device (4 available)
• Pixel 6 Pro (mobile) • 21041FDEE0029K • android-arm64 • Android 14 (API 34)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.2283]
• Chrome (web) • chrome • web-javascript • unknown
• Edge (web) • edge • web-javascript • Microsoft Edge 117.0.2045.36
[✓] Network resources
• All expected network resources are available.
• No issues found!
adilh@DESKTOP-M5JKVNO MINGW64 ~/Documents/GitHub/flame_2771 (main)
$ # pubspec.lock
flame:
dependency: "direct main"
description:
name: flame
sha256: f1ed45b49db36f6650882900f3216516d5c2628400bad8b4e92d83c116d79b12
url: "https://pub.dev"
source: hosted
version: "1.9.1" |
Maybe this is a bug affecting older versions of Android? void main() {
final engine = Engine();
runApp(MaterialApp(home: SafeArea(child: Scaffold(
body: GameWidget(game: engine),
))));
} |
@adil192 I don't think so, I can reproduce the error on the latest android api 34 in an emulator. Did you run the app through The problem still happens using regular constructor. |
Thanks, I can reproduce it now. @spydon When the app is launched, we (sometimes) get flame/packages/flame/lib/src/game/game_widget/game_widget.dart Lines 257 to 259 in bde34ef
I propose to change this to not use void initCurrentGame() {
// ...
currentGame.lifecycleStateChange(AppLifecycleState.resumed);
} Another option could be to wait a little before |
Yeah, I think we'll have to go with hardcoding it then. Can you put up a PR? |
Current bug behavior
Flame is not rendering the sprites sometimes. It appears for a moment after pressing "back" (closing the app), or after going "home" and go back to the app. But after closing, and running the app again, it doesn't render again too. See this video: https://youtu.be/gIdxXewLPNU
Expected behavior
Flame is always rendering the sprites.
Steps to reproduce
I build this as an APK and install it on my phone:
Flutter doctor output
More environment information
Log information
No error on the log
More information
The text was updated successfully, but these errors were encountered: