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

hello,
I tried yield(get_tree(),"idle_frame") in _ready() function and it seems to work fine: when yield execute, it resumes execution just the line after and process goes smoothy.

but

I tried yield(get_tree(),"idle_frame") in a throwaway function called in _process(delta) and it doesn't work like that: each line of code between "yield" and end of function get executed twice.

Did it work as intended or is it a bug?

I'm using Godot 3.1 beta9

thanks
Graziano

in Engine by (54 points)

Cannot reproduce this in beta 9 on my machine. Can you share the code? Or try to print something

1 Answer

+1 vote

I found out:
using yield() in _process() is troublesome because the script turn into a wait state, but application is still going to execute _process() the next frame time even if the wait state is still active.

I had only to build a bounduary around yielding function:

                 if !yielding:
                    yielding = true
                    some ()
                    yield(get_tree(),"idle_frame")
                    yielding = false
by (54 points)
edited by
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.