Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | CDHouston7270 |
My code is able to export a screenshot to a file properly, but when I try to set the image to a sprite in-game, it just sets the sprite to null! Here is my code snippet:
func screen_capture(sprite):
var img = get_viewport().get_texture().get_image()
img.save_png("screenshot.png")
var tex = ImageTexture.new()
tex.create_from_image(img)
sprite.texture = tex
Any ideas? Please and thank you!