This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

ENG:
How can I check how many seconds have passed since the start of the script execution?
I need to make it so that I can check exactly how many seconds have passed since the function was executed. In my case, it is 2 seconds.
RUS:
Как я могу проверить, сколько секунд прошло с начала выполнения скрипта?
Мне нужно сделать так, чтобы я мог точно проверить, сколько секунд прошло с момента выполнения функции. В моем случае это 2 секунды

Thanks very much!

Godot version 3.3.1
in Engine by (49 points)

1 Answer

0 votes

Hi,
do you mean:

https://docs.godotengine.org/en/stable/classes/class_os.html#class-os-method-get-ticks-usec

int get_ticks_msec ( ) const 

Returns the amount of time passed in milliseconds since the engine started.

or you just save this value and compare it to "now"

var start = OS.get_ticks_msec()
#then later
print( str(OS.get_ticks_msec()-start)+" have past since start" )
by (4,088 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.