Best way to count minutes?

So I need to make a day system in which an in-game hour equals a real minute,
since I don’t really need to check for every second on that minute,
what would be the best (performance-wise) way to do this?

Should I make an invoke reapeting every minute?
A coroutine that waits for 60 seconds?
Or just use update with deltatime?

Thanks!

I’m not entirely sure what would be the absolutely most efficient. but I think simply using deltatime would be fine.

float timer = 0;

void update{
       timer += time.deltaTime;
            if ((int)timer%60 == 0){
              //increment days
              }
 }

There are many ways to do this, but I think the easiest would be to change the TimeScale.

Edit > Project Settings > Time - in the Inspector > Time Scale - change this from 1 to 60 (1=1min per min, 60=1hr per min). You can also change it via script with Time.timeScale.

Now whenever you use Time.deltaTime it is scaled 60 times as much as Time.unscaledDeltaTime.

You can use this script to show how many ‘simulated minutes per real minute’ have passed since last frame…

public class TimeCounter : MonoBehaviour
{
	private void OnGUI()
	{
		// simulated minutes per real minute, for this frame
		float t = (Time.deltaTime / Time.unscaledDeltaTime);

		GUI.Label(new Rect(0, 0, 100, 30), t.ToString("0.00"));
	}
}

Or if you don’t want to use the global TimeScale, you can create a custom time script like so…

public class TimeCounter2 : MonoBehaviour
{
	public float timeScale = 60f; // 60 simulated seconds per real second

	[SerializeField] // for inspector viewing
	private float simulatedSeconds = 0f;

	private void Update()
	{
		simulatedSeconds += Time.unscaledDeltaTime * timeScale;
	}

	private void OnGUI()
	{
		int simulatedMinutesCount = Mathf.RoundToInt(simulatedSeconds / 60f);
		GUI.Label(new Rect(0, 0, 100, 30), simulatedMinutesCount.ToString());
	}
}