Skip to content

quitPlayer method crushes the entire application #214

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

Closed
gianfrancopapa opened this issue Sep 25, 2020 · 11 comments · Fixed by #245
Closed

quitPlayer method crushes the entire application #214

gianfrancopapa opened this issue Sep 25, 2020 · 11 comments · Fixed by #245

Comments

@gianfrancopapa
Copy link

Hi! When trying to use the method quitPlayer on dispose the app crushes.

void onUnityCreated(controller) {
    this._unityWidgetController = controller;
    ...
}
@override
  void dispose() { 
    _unityWidgetController.quitPlayer();
    super.dispose();
}

I don't know if this is related to the library or is related to a bug in Unity.
In xcode I am getting these 2 errors before the crush, could it be something about onDestroy() method?

First error:

[XRInputSubsystem] A device disconnection with the id 0 has been reported but no device with that id was connected.
UnityEngine.SubsystemManager:DestroyInstance_Internal(IntPtr)
UnityEngine.IntegratedSubsystem:Destroy()
UnityEngine.XR.Management.XRLoaderHelper:DestroySubsystem()
UnityEngine.XR.ARKit.ARKitLoader:Deinitialize()
UnityEngine.XR.Management.XRManagerSettings:DeinitializeLoader()
UnityEngine.XR.Management.XRGeneralSettings:DeInitXRSDK()
UnityEngine.XR.Management.XRGeneralSettings:Quit()
System.Action:Invoke()
UnityEngine.Application:Internal_ApplicationQuit()

Second error: I think this error is more related to something done wrong in unity side but just in case.

Setting up 1 worker threads for Enlighten.
  Thread -> id: 16c707000 -> priority: 1 
Audio Missng System.NullReferenceException: Object reference not set to an instance of an object.
  at PortalTrigger.ChangeMaterials (System.Boolean _fullRender) [0x00000] in <00000000000000000000000000000000>:0 
  at PortalTrigger.OnDestroy () [0x00000] in <00000000000000000000000000000000>:0 
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
PortalTrigger:ChangeMaterials(Boolean)
PortalTrigger:OnDestroy()

@gianfrancopapa gianfrancopapa changed the title quitPlayer method crush the entire application quitPlayer method crushes the entire application Sep 25, 2020
@qiuguian
Copy link

I also got this problem, how to fit it.

@qiuguian
Copy link

@gianfrancopapa It works for me,but it can run again _:
@OverRide
void dispose() {
_unityWidgetController.pause();
_unityWidgetController.quitPlayer();
super.dispose();
}

@gianfrancopapa
Copy link
Author

Hi @qiuguian, I tried pausing the player and quiting and it didn't crush. However I can't open again another instance of the unity player. I was reading the unity documentation and found out this:

unityLimitations
quitApplication

So, I think this is suposed to happen once you call quitPlayer() method.

@qiuguian
Copy link

@gianfrancopapa This is indeed the case, and I currently do not have a good way to sort it out.

@qiuguian
Copy link

I tried to use unload instead of quitPlayer, and them post a message to tell unity to clean object,This is my current approach。Can't quit all unity.

@juicycleff
Copy link
Owner

@qiuguian yes there is a limitation to quitting the unity player as it also kills the main thread, which in turn kills the entire app. This is a limitation from unity but I heard might be fixed in the future. Best use unload. Albeit unload is not very functional for iOS as you can't recreate the player. I'm trying to fix this at the moment

@singno
Copy link

singno commented Nov 1, 2020

@qiuguian yes there is a limitation to quitting the unity player as it also kills the main thread, which in turn kills the entire app. This is a limitation from unity but I heard might be fixed in the future. Best use unload. Albeit unload is not very functional for iOS as you can't recreate the player. I'm trying to fix this at the moment

Hello, juicycleff. Has the unload function fixed? I find it works well in the official repo.

https://github.com/Unity-Technologies/uaal-example

@mathtasatlime
Copy link

Okay, I'm also stuck at the mom at the same prob.
I create an UnityView (game in unity) in my flutter App. After the games is finished the app continues in flutter by starting a different frame, but the unity is still running in the back. When I now try to start another game I dont know how to say to Unity to restart the game. What is the right trigger point to call the function restart() in my GameManager GameObject?
The only message I receive is when the unityviewcontroller is created but at that point I can not be sure that the GameManager already exists.

Do you have an idea or know a good timepoint when to trigger restart()?

@nominator
Copy link

This issue is closed in 3.0.0 according to the changelog, however when I tried, it still kills the app. Also the doc in the code says that the optional silent argument to quit function is supposed to prevent the kill but is WIP. So how come this bug is closed here? Can @juicycleff please provide some detail. I need the ability to leave a unity player instance and reload with a different state of the game. It would massively help if there is some way to do that. Thanks

@khal-it
Copy link

khal-it commented Jan 12, 2021

im still facing the same issue in the current version (3.0.2) ...

@tom-eg
Copy link

tom-eg commented Jan 28, 2021

I'm using 3.0.0 unity script and current version 3.0.2, but problem's same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants