I'd like to have my Unity game delete itself when it reaches the end. As in - delete the .exe from wherever it's stored on the user's computer. Is this possible with JavaScript within Unity?
Thanks!
I'd like to have my Unity game delete itself when it reaches the end. As in - delete the .exe from wherever it's stored on the user's computer. Is this possible with JavaScript within Unity?
Thanks!
You have full access to .net's FileIO classes, which allow for creating, reading, writing and deleting files.
However, I haven't tried this, but on windows at least, I would guess you'd run into the problem of the file being un-deletable because it's currently in use. In this case you might have to make your original exe copy a temporary batch file or other small exe file to the windows temp folder, and have that delete your original exe. You might then be able to use a registry entry to delete the temp file next time windows restarts, as described here.