ui/canvas/button - quit aplication in Csharp doesnt work

0 votes
asked Jul 16, 2018 by outlinegorilla (180 points)

i have made a simple button to quit the ar application.
the button doest work after build.
any help?
thank you

QuitApplication.cs

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class QuitApplication : MonoBehaviour {

public void quit() {
Application.Quit();
}
}

1 Answer

0 votes
answered Jul 17, 2018 by tagchennai (620 points)
edited Jul 17, 2018 by tagchennai
System.Diagnostics.Process.GetCurrentProcess().Kill();
I sure hope you added the onClick behaviour to your button. Else, I recommend this, add a script to the canvas, define add the button to a public definition of a button, like this :-
public Button butt;
And in the Start() function, add-
 butt.onClick.AddListener(stopper);
and outside the start and update functions, create a private function stopper()
stopper(){
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
commented Jul 17, 2018 by tagchennai (620 points)
For some reason Application.Quit() dosent seem to work on android.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...