Take screenshot and apply it as a texture

Hello, i have a problem where i take a screeshot inside a folder and would like to use it as a texture in a canvas, picture, but i have no idea how. Heres how i take the screenshot.

        ScreenCapture.CaptureScreenshot(Application.dataPath + "/screenshots/" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".png");
        UnityEditor.AssetDatabase.Refresh();

and would also like to delete these screenshots after pressing a button. Thanks in advance!

Do you mean at editor time or at runtime? Line 2 will not work anywhere except inside the Unity editor.

1 Like

In runtime. When the game starts i want to take a screenshot and use it as a texture. But when i start it again and take a screenahot, i want to use that screenshot.

You want this method instead:

Didnt knew about this, thanks

1 Like