- Home /
Main menu touch input for android
found this in a tutorial: var isQuitBtn = false;
function OnMouseUp() {
if(isQuitBtn)
{
Application.Quit(); } else { Application.LoadLevel(1);
} }
bt i need it fr android touch... found this in unity reference(http://docs.unity3d.com/Documentation/ScriptReference/Input-touches.html), bt is of no use...
function Update () { var fingerCount = 0; for (var touch : Touch in Input.touches) { if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled) fingerCount++; } if (fingerCount > 0) print ("User has " + fingerCount + " finger(s) touching the screen"); }
Answer by zyzof · Aug 22, 2012 at 10:54 AM
So you're wanting to detect when the user pushes the menu button?
Use:
if (Input.GetKey(KeyCode.Menu)) {
//Do stuff
}
in your Update() method.
You might find http://forum.unity3d.com/threads/61851-How-to-Use-hardware%28H-W%29-MENU-KEY useful too.
Answer by MahmoudH.Gaweesh · Jun 22, 2014 at 02:53 PM
Its probably With OnMouseUp function
public bool IsQuitButton;
OnMouseUp (){ if(IsQuitButton) { //Then Close The Game Application.Quit (); } else { Application.LoadLevel("Level1"); } }
Then On The Quit Text Then But The Boolean as True.