MY English is bed>
Touch hold for 5 second then call a function
private float touchTime = 5;
private float current = 0;
private bool touched = false;
void LongTouch() {
//what ever code
//after that process touched again false
touched = false;
}
void Update() {
if(Input.touchCount>1 && !touched) {
if(current>=touchTime) {
touched = true;
current = 0;
longTouch();
}
else {
current +=time.deltaTime;
}
}
}
var timer : float = 0;
var isTicking : boolean = false;
function Update(){
if(isTicking){
timer += Time.deltaTime;
if(timer > 5f){
Application.Load("whatever you want to load");
}
}
if (Input.touchCount > 0) {
var touch = Input.GetTouch(0);
switch (touch.phase) {
case TouchPhase.Began:
isTicking = true;
break;
case TouchPhase.Ended:
isTicking = false;
timer = 0 ;
break;
}
}