Unity-Technologies / uaal-example

Other
736 stars 234 forks source link

iOS Unity not quitting properly #55

Closed InvixGG closed 2 years ago

InvixGG commented 2 years ago

I am currently using UaaL for our Xamarin app. I got everything working instead of a standard quit Unity action.

If I use UnityFramework.QuitApplication. It doesn't just quit Unity. It closes the entire app. When I use UnityFramework.UnloadApplication it just unloads Unity and stops working. But also won't go back to the main page of the iOS app I set up.

I have a button on my app home page that launches Unity. And I have a button that should close Unity again when pressed. And then it should go back to my app home page. But it doesn't, as I explained above.

Is there a way to do this properly?

sakshi-oodles commented 2 years ago

Hi @Invixvb ,

did you find any solution regarding quitting application properly? i am also stuck with this problem. i am also facing exact problem you have mentioned in above comment for my unity swift app.

Please let me know if there is any solution available.

Thank you

superbderrick commented 2 years ago

@sakshi-oodles Any sample test to reproduce the issue?, I also made my app based on Swift, but working well https://github.com/superbderrick/UnitySwift

sakshi-oodles commented 2 years ago

Hi @superbderrick , Thanks for quick response. Actually i can see native buttons like unload and quit on your project and i want solution for unity close/quit button to quit unity app back to native app?

i am having problem on unity close button as i have used Application.quit on close button and it closes the whole native app. But i want only unity app should close and when again click on showUnity then unity app should initialise properly but it closes whole native app.

Please help me to resolve this issue.

superbderrick commented 2 years ago

@sakshi-oodles can u try to call Aplication.unload? https://docs.unity3d.com/ScriptReference/Application.Unload.html It can unload unity from unity side

You can check whether it has been unloaded normally through the delegate

sakshi-oodles commented 2 years ago

@superbderrick yes, i have also try Application.unload and after using this when i try to run app for 5 or 6th time then app showing some memory warnings and got crashed.

superbderrick commented 2 years ago

@sakshi-oodles As in the sample delegate below, unload is called once and initunity should not be called again before the corresponding unload delegate is called After checking whether unloading is normally done through the delegate, try call initunity again.

https://github.com/Unity-Technologies/uaal-example/blob/master/NativeiOSApp/NativeiOSApp/MainViewController.mm

superbderrick commented 2 years ago
vijayOodles commented 2 years ago

@superbderrick called but not able to properly restart the unityapp again