When touch, go to next level

Hello,

I have a script here:

var levelToLoad : String;
var soundhover : AudioClip;
var beep : AudioClip;
var QuitButton : boolean = false;
function OnMouseEnter(){
audio.PlayOneShot(soundhover);
}
function OnMouseUp(){
audio.PlayOneShot(beep);
yield new WaitForSeconds(0.35);
if(QuitButton){
Application.Quit();
}
else{
Application.LoadLevel(levelToLoad);
}
}
@script RequireComponent(AudioSource)

But when i test it on my samsung galaxy s2, And click on the object which have that script, it doesn’t do anything and it won’t go to the next level. Also it’s verry slow, like 10 fps. What can I do about that? And would you guys help with the script? Thanks!

I’m pretty sure that OnMouseUp requires a 1 or 0 in the ()'s. This is how it usually knows which button needs to be pressed.

Or, if you’re doing it on a phone, there might be a different function for touch screens.

Is there actually a OnMouseEnter() On android ? because i’m looking for one :stuck_out_tongue:

The touches need to be read. if you need input from windows for testing, i guess just capture both and make a method for doing whatever.

Checkout the manual on input on mobile devices.