Making a 2D game and am about done. One of the last things I have to do is make the “Quit” button on the main menu functional. I have a text mesh with a box collider around it (like all my other menu buttons) and when I touch it, I need it to exit the game back to Android OS. I use the same script for my menu buttons just tried to change the output to
“Application.Quit();” but it doesn’t work. Any help is much appreciated. C# please too…
Here is my code…
using UnityEngine;
using System.Collections;
public class Quit : MonoBehaviour {
void Start () {
}
void Update()
{
if (Input.touchCount == 1)
{
Vector3 wp = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
Vector2 touchPos = new Vector2(wp.x, wp.y);
if (collider2D == Physics2D.OverlapPoint(touchPos)){
Application.Quit();
}
}
}
}