I'm trying to make a simple console application and don't want to use Unity, but I want to implement a timer, so I would want to use Time.deltaTime.
Asked
Active
Viewed 1,594 times
0
1 Answers
0
How to Measure deltaTime
It is measured by calling a timer every frame per second that holds the time between now and last call in milliseconds. Thereafter the resulting number (delta time) is used to calculate how far, for instance, a video game character would have travelled during that time.
Basic implementation in Javascript
let lastTime = performance.now(); // performance.now() returns the current timestamp
function gameLoop() {
let now = performance.now();
let deltaTime = now - lastTime;
lastTime = now;
}

SCodes
- 3
- 3

mohsen shahi
- 1
- 1
-
1This answer would be better if it included code showing how to do that. – DMGregory Jul 02 '22 at 12:36
Time.deltaTime
is a Unity specific thing. If you want one in console application you can use a 3rd party lib or write your own.Time.deltaTime
is calculated as time between frames, so if there are no frames and Unity engine is not running - the value probably won't be calculated. That is my assumption. Even if the value would be calculated it would be completely irrelevant value to console application. – Candid Moon _Max_ Jul 02 '22 at 11:09