-
Notifications
You must be signed in to change notification settings - Fork 523
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
Blank screen on initializing UnityWidget, iOS #540
Comments
Exact same issue here, on iOS only, the UnityWidget is blank but the sound of the Unity game is playing. I tried to pop back the screen after x seconds and then rerunning the UnityWidget and it's working then like you said, but it's not user friendly. It was perfectly working a few weeks ago, I'm trying to figure out since when it's not working anymore because I did many upgrades. What I have tried so far without any results :
I have also recently updated Flutter from 2.8.1 to 2.10.1, I have not tried yet if this could be related to the issue. |
As a workaround for the moment for iOS, I pop the UnityWidget on the first opening in the |
@Drarox i ran into the same problem, would you mind to share with me your solution on “pop the widget and relaunch it after 1 sec” part ? |
There may be a better way to do this, but my solution to popping the widget and relaunching it was to use two Future.delayed() in onUnityCreated. So something like: widget.isInit ? Future.delayed( The initCallback() in the enclosing Class pushes the Class with the UnityWidget in it again: Navigator.push( I also added a loading screen at the top of a Stack that pops after another Future.delayed duration. |
@jafitz26 thanks for the sharing, I don’t quite understand the part on widget.isinit and widget.initCallback is it possible for you to share the whole code for me to learn about it? |
Sure, here is the code within the context of the two classes I'm using:
|
Other approach that works for me is remove the UnityWidget for the widget tree. You can use the same time intervals and instead of navigate between pages you can call setState and with a conditional, remove from the widget tree. Like this:
|
@jafitz26 thanks for the sharing your code, I had a quick implementation just now and it does work on iPad but something went wrong when it comes to iPhone, i will check on it myself and share it here if I managed to found the cause of it. @WellingtonBipo thanks for the generous sharing ! Will try your suggestion today, |
This is an issue related to the For now, I've changed the method body to the following and it works:
|
@Holosynthetic thanks very much. It's works fine. The only problem is that this file is inside flutter_unity_widget and if you delete the package and run flutter pub get you have to change the code again. And to make easy to find the file, follow the path ios/.symlinks/plugins/flutter_unity_widget/ios/Classes/UnityPlayerUtils.swift (flutter_unity_widget folder is a link) |
Hi, I've a similar problem but with Android. I would like understand if solutions writed in this issue work also on Android. Thanks and sorry for my english |
@Holosynthetic thanks for the fix, had the exact same issue and this resolved it for me. The code has changed a bit in the latest version, so it's now:
@WellingtonBipo I've done a pull request for this change so hopefully @juicycleff can merge it into master and publish a new version, so that you don't have to manually edit the files each time you
|
No this is a fix for iOS only. I suggest making sure you're using the latest version of the package, use Unity 2022.1.0 and double-check you have followed all the setup steps. Also, try using the |
Hello @jamesncl & @WellingtonBipo , |
I know this has been fixed in package version This bug popped up for me on changing a minor Unity version for an older project.
Given that this issue was known when using Unity 2020 or 2021, I guess some change got backported to Unity 2019 LTS. @VivianKuKu
|
Is this fixed? I still have this issue after I tried 2022.1.7f1, 2022.1.1, 2022.1.1-v2 unitypackages |
Ok...I checked UnityPlayerUtils.swift file in my project. Somehow some lines are commented and |
Here is my solution change UnityPlayerUtils.swift -> createPlayer function func createPlayer(completed: @escaping (_ view: UIView?) -> Void) {
} |
This works, but the widget seems to overlap the AppBar of the Scaffold now. The back button is missing. Without the fix, the back button is there, but also the white screen. |
I'm still experiencing this bug with version 2022.2.1 ( tried with unity 2020, 2021 and 2022).
Now, if I load a normal scene, everything works; but if I push an AR scene, I get the blank screen. The AR scene is actually running: I can hear the correct audio when I point to an AR marker. I tried @jamesncl solution, but as @kamami said in the last message, Flutter UI is now below the unity widget and there's no way to go back. |
On first running the UnityWidget, the Unity Game's sound plays, but a blank screen is pulled up, on iOS only. This screen is the same color as my main app's loading screen.
If I hot restart the app from this screen, the Unity game's sound continues playing behind the main app, and after navigating back to the UnityWidget, the Unity game runs as intended.
The only work around I've found is automating a pop back to the main app, then rerunning the UnityWidget, which is not a good user experience.
--
Error output:
CrashReporter: initialized
Built from '2021.2/staging' branch, Version '2021.2.11f1 (e50cafbb4399)', Build type 'Release', Scripting Backend 'il2cpp'
MemoryManager: Using 'Default' Allocator.
[UnityMemory] Configuration Parameters - Can be set up in boot.config
"memorysetup-bucket-allocator-granularity=16"
"memorysetup-bucket-allocator-bucket-count=8"
"memorysetup-bucket-allocator-block-size=4194304"
"memorysetup-bucket-allocator-block-count=1"
"memorysetup-main-allocator-block-size=16777216"
"memorysetup-thread-allocator-block-size=16777216"
"memorysetup-gfx-main-allocator-block-size=16777216"
"memorysetup-gfx-thread-allocator-block-size=16777216"
"memorysetup-cache-allocator-block-size=4194304"
"memorysetup-typetree-allocator-block-size=2097152"
"memorysetup-profiler-bucket-allocator-granularity=16"
"memorysetup-profiler-bucket-allocator-bucket-count=8"
"memorysetup-profiler-bucket-allocator-block-size=4194304"
"memorysetup-profiler-bucket-allocator-block-count=1"
"memorysetup-profiler-allocator-block-size=16777216"
"memorysetup-profiler-editor-allocator-block-size=1048576"
"memorysetup-temp-allocator-size-main=4194304"
"memorysetup-job-temp-allocator-block-size=2097152"
"memorysetup-job-temp-allocator-block-size-background=1048576"
"memorysetup-job-temp-allocator-reduction-small-platforms=262144"
"memorysetup-temp-allocator-size-background-worker=32768"
"memorysetup-temp-allocator-size-job-worker=262144"
"memorysetup-temp-allocator-size-preload-manager=262144"
"memorysetup-temp-allocator-size-nav-mesh-worker=65536"
"memorysetup-temp-allocator-size-audio-worker=65536"
"memorysetup-temp-allocator-size-cloud-worker=32768"
"memorysetup-temp-allocator-size-gfx=262144"
-> applicationDidFinishLaunching()
-> applicationWillEnterForeground()
-> applicationDidBecomeActive()
Unexpected node type.
Unexpected node type.
GfxDevice: creating device client; threaded=1; jobified=0
Initializing Metal device caps: Apple A9 GPU
Initialize engine version: 2021.2.11f1 (e50cafbb4399)
flutter: in onUnityCreated
CrashReporter: No pending report exists at /var/mobile/Containers/Data/Application/D17E09AB-1621-4810-8A8E-EDBB1BE93C4C/Library/Caches/CrashReports/crash-pending.plcrash
The text was updated successfully, but these errors were encountered: