I am a beginner of Unity 3D. I am writing an android app, and my start menu have an exit button. My idea is just very simple: after users press the exit button, the application will close.
I know Application.Quit() for quiting an app. But I just dont know how to detect a touch from user on a button and return the application.quit() method. Should I use sth like button.onclick or input.gettouch? Thanks!
Hey garenthlamyh o/
Take a look here:
https://www.youtube.com/watch?v=J5ZNuM6K27E
https://unity3d.com/pt/learn/tutorials/topics/user-interface-ui/ui-button?playlist=17111
You have to create a public function and put it on a button, something like this:
public void ExitApp()
{
Application.Quit();
}
in this video, you can see how to link a function to a button