- Home /
remaining question solved by android built-in facility for all apps.
Quitting a game
I'm following a tutorial in udemy where some of the codes are a bit outdated. I'm looking for codes where i can quit a game. In an earlier case, the instructor gave SceneManager to replace the outdated Application. Now my code is :
public void Exit()
{
SceneManager.Quit();
}
I have gone to the unity documentation, selected the version i used - 2019.1.8 - as recent ones have built in problems that damaged my project earlier. I have tried SceneManager.UnloadSceneAsync(); but it can't be used due to some error. What can I use?
Answer by Beginner_at_Unity · Aug 07, 2019 at 08:02 AM
OK thank you. But due to technical reasons, I am unable to create the .apk installation file so this can only be tested at a later time / stage.
Answer by georgelewising · Aug 07, 2019 at 09:54 AM
Application.Quit();
is the recommended way of "quitting" an application. However - to add a caveat - it is not recommended to perform any sort of manual quit action on iOS (during regular circumstances - at least).
Answer by muhammadmohid · Aug 07, 2019 at 02:00 PM
@JulianHSC Use:
public void QuitGame()
{
Application.Quit();
}
This Is Way Better As SceneManager Is Obsolete. This Is More Easy And Doesn't Require The "using UnityEngine.SceneManger;" line. Hope This Fulfills Your Need :)