Replies: 1 comment
-
|
I wouldn't use frane_pre_draw here, since SceneTree.process_frame exists and frames are not guaranteed to be drawn for every process tick (for example, if you have low processor mode on). I will add that I do think this is a fairly common pattern and it'd be cool if Callable got some sort of mechanism for it, although in my opinion it should be called func do_stuff() -> void:
(func(): print("hi")).queue_call()which would end up printing once for every call rather than once per frame |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When I create tools, I often have methods to generate or update nodes:
And to prevent these functions from being called multiple times in the same frame, I have method
queue_update()andqueue_generate(), currently, the simplest version I've found to do this is to write this:I wanted to know if there was a shorter / more optimal way, and if not I would like to suggest adding a method, I'm not sure what form it should take, maybe something like a
call_deferredvariant:update.queue_call_deferred()Beta Was this translation helpful? Give feedback.
All reactions