flutter-unity-view-widget
flutter-unity-view-widget copied to clipboard
quit and unload methods not Implemented
If i try to invoke unityWidgetController.quit() or unityWidgetController.unload() am getting Missing Implementation Error
Which platform is this (ios, android, web)? And how/where are you calling these functions?
Quit is useless as it kills your entire app, but i've used unload plenty of times.
Iam trying this on Android, and am calling the unityController.unload() at app's dispose (stateful widget) method. I can see that game is never closes like once i opened the game and no matter how many time i pop this page and come again and the game still in the same state where i last time leaves on pop Method
Also when i open the game it would make disappear the android's navigation bar and status bar and it not restored when the game end, can anyone help this.. i tried many ways but none of em working
Iam trying this on Android, and am calling the unityController.unload() at app's dispose (stateful widget) method. I can see that game is never closes like once i opened the game and no matter how many time i pop this page and come again and the game still in the same state where i last time leaves on pop Method
I think this error might come from using the unitycontroller when the widget has already been disposed.
Can you try calling unload before popping. Either do it before Navigator.of(context).pop
, or in a WillPopScope
.
Also when i open the game it would make disappear the android's navigation bar and status bar and it not restored when the game end, can anyone help this.. i tried many ways but none of em working
Once Unity goes fullscreen, flutter can't seem to revert that on android. You can do this by calling a Unity function from flutter, that makes Unity disable fullscreen.
public void DisableFullscreen(string str = "")
{
#if UNITY_ANDROID
Screen.fullScreen = false;
#endif
}
Hey also, i passed unLoadonDispose to be true on UnityWidget, but i dont think it is working either. I needed that game is to be totally closed when the page is closed from flutter. And the game should reload again after when i opened the game page... But it seems the game is being always loaded.. like if i open the game page for first time it would take some time to load and shows the game . But after i close the game page and repopen the game page the game is already in the same state where i lastly visited the game page. I dont want this behavior
I am impacted too on iOS. Calling unload in a dispose method does not unload unity at all.
It was working fine in 2020.3.25
unloadOnDispose
does not work neither.
Same here as well. Tried only iOS. Using version 2022.2.0 and Unity 2022.3.34. Tried manual unload and unloadOnDispose and didn't work.
Bumping up this thread, i literally dint touched flutter (and unity) almost a year. But happy to help. I think we should not call quit
as @timbotimbo said since it would just kill the process (where our flutter app also lives in the same process, hence it will also get closed)
https://discussions.unity.com/t/integration-unity-as-a-library-in-native-android-app/744894/5
Someone here explained what i want to just convey, the implementation of quit
on UnityPlayer
in unity-classes.jar
which eventually kill the process. We dont need that, we just need to destroy the unity activity and its memory. I think in the discussion someone mentioned "we are working on it"
Hope for good 🤞