![]() In order to determine which platform the game is actually running on, you can use atform, this would allow you to create a reasonably generic Quit() method, which could handle running within the Unity editor, a standalone build, Android, iOS or WebGL builds - and effectively do something different (or nothing) for each case. Thus, a user would use the Home button, which effectively sends the app to the background.Īndroid devices have the back button and I would expect them to behave in a similar fashion. I believe, certainly in the case of iOS, that the memory is managed and apps are closed only if more memory needs to be freed up. The above will stop the game from playing within the Unity editor if the Quit() method is called, or, if the game is running outside of Unity it will close.įor mobile devices, both Apple and Google will have specifications on whether you should quit the application or not. If you just want to have a quit button which stops the game from within the editor, returning you to Unity, but, in a build as above actually closes the application, you could use the following public void Quit() No one else seems to be having this problem. I have a GameOver canvas with a quit button, and the text on the button points to the quit game script, and the canvas is set to interactable, and points to the end game text and the correct script. ![]() ![]() I can’t get my quit button to work to end the game on either level. The above would cause the running application to close, just as if you were using an application like Microsoft Word and went to File -> Exit, or, click on the X icon in the top corner. The game we are making uses premade scripts. If you create a standalone/PC/Mac build then you could have a quit button and use the following public void Quit() How to quit the game is going to depend on the platform you are targeting.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |