Home > Mobile >  Is there someone who can help for time displaying
Is there someone who can help for time displaying

Time:02-24

i want to display time between the time a button display on the screen and the time the user click on the button, after that i want to display the difference between these 2 time onto next scene

CodePudding user response:

You can do like that:

private float firstClickTime, secondClickTime;
private float timeDifference;

public void button1_Click(){
firstClickTime=Time.time;
}

public void button2_Click(){
secondClickTime=Time.time;
timeDifference=secondClickTime-firstClickTime; //This give you passed time in seconds
}

You can use timeDifference variable anywhere you want after that.

  • Related