We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 57baf0a + 7a9b45f commit b548a84Copy full SHA for b548a84
viewport/screen_capture/screen_capture.gd
@@ -4,9 +4,8 @@ onready var captured_image = $CapturedImage
4
5
func _on_CaptureButton_pressed():
6
get_viewport().set_clear_mode(Viewport.CLEAR_MODE_ONLY_NEXT_FRAME)
7
- # Let two frames pass to make sure the screen was captured.
8
- yield(get_tree(), "idle_frame")
9
+ # Wait until the frame has finished before getting the texture.
+ yield(VisualServer, "frame_post_draw")
10
11
# Retrieve the captured image.
12
var img = get_viewport().get_texture().get_data()
0 commit comments