Accumulating timer:
private float time;
void Update()
{
time += Time.deltaTime;
if (time >= 5f)
{
Debug.Log("5 seconds passed");
time = 0f;
}
}
Countdown:
timeRemaining -= Time.deltaTime;
timeRemaining =
Mathf.Max(
timeRemaining,
0f
);