![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Zuckey |
How do I make my functions just return once but not every frame or second while they are called in process(delta) or physics_process(delta) =
![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Zuckey |
How do I make my functions just return once but not every frame or second while they are called in process(delta) or physics_process(delta) =
![]() |
Reply From: | jgodfrey |
You might want to provide some more details about what you’re trying to do specifically as there’s likely a better way to accomplish your goals.
But, for the question as asked, you’d just want to set a flag when the function is called for the first time, and then not call it any more. Though, on the surface, that sounds like a better match for calling the function from _ready()
.
Anyway, something like this should satisfy the request:
var has_been_called = false
func _process(delta):
if !has_been_called:
one_call_function():
has_been_called = true
Thanks I appreciate it! I have managed to fix my problem, The problem was caused by a variable that has been set every process call. Anyways thanks for helping out.
Zuckey | 2020-11-09 19:58