0 votes

I am trying to get image of scene, which requires yield for a second or so.
However I wish to make it as fast as possible, how would I do that ?

This is the code:

#yield(get_tree().create_timer(1), "timeout")
#yield(node, "tree_entered")

var imageTexture = ImageTexture.new()
var image = Image.new()

Godot version 3.2.3.stable
in Engine by (87 points)

Skipping a frame or two, doesn't it work? To skip a frame use: yield (gettree (), "idleframe")

If I do yield idleframe 2 times it works. Does it still work if its ran on different computer (faster or slower...) ?

I suppose that yes, the time between each frame can be slower or higher depending on the pc but at the end of the day it will always jump 2 frames

Okay, great! Thanks you very much.

1 Answer

+1 vote

Adding yield idle_frame twice does the job.

yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")
by (87 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 webmaster@godotengine.org with your username.