I want to take some screenshots and then delete some screenshots.
How do I control where these screens are placed --in what directory and how do I delete them. Right now they are just placed in the assets folder (in the editor) if I use Application.CaptureScreenshot. Can I place them wherever I want.
I’d like to place them all in a folder and then delete the folder. Alternatively I can delete them all separately but I’m having trouble finding the path to the files so I can use the System.IO’s File.Delete(path);
I’m not sure if I have to put file:// in front or not. I’m using Application.dataPath to find the file.
Can someone clarify or provide a unity code example for System.IO File.Delete(path);
I know the file path changes depending on whether it’s iphone, or editor.
According to that page, you can pass a full path. You could use something like Path.Combine() with Application.persistentDataPath and your desired screenshot name.
Instead of deleting old screenshots, why not just append a number to the filename? Or a timestamp?
If you’re sure that you want to delete files programmatically, you could use functions like File.Delete() with Directory.GetFiles()