Computer Language/Unity

[Unity] Time.deltaTime

정우섭 2019. 3. 6. 23:32

Time.deltaTime - Returns how long did the last frame took to complete, and it's unit is second.


We can use this mechanism like this


float timeCount = 0;

void Update()

{

timeCount += Time.deltaTime

if (timeCount > 3)

{

Debug.Log("Throw the stone");

timeCount = 0

}

.

.

.


We can print log every 3 seconds if we code like  this.