Answers for "if x is true for ... seconds unity"

C#
0

if x is true for ... seconds unity

bool A;
float countDown = 3;
float stopwatch = 0;

if (A == true)
{
	stopwatch += Time.deltaTime;
    if (stopwatch >= countdown)
    {
    	Debug.Log("A has been true for 3 seconds");
   	}
}
else
{
	stopwatch = 0;
}
Posted by: Guest on September-30-2020

Code answers related to "if x is true for ... seconds unity"

C# Answers by Framework

Browse Popular Code Answers by Language