Access is denied error help.

Hi everyone, I have a script that’s trying to access a folder I created in my C drive. But for some reason I get an access is denied error when I start up my script. Is there a way to tell unity that it can use this file?

string path;
void start(){
path = @"C:/new folder";//error access is denied
}

Windows past XP I assume? Windows is very strict when it comes to C: drive and the only place that is safe to write is documents folder. Does it give the error if you run the game/program as admin?

yep, it still says access is denied and I tried moving the file I created to the documents folder but it’s still says access is denied.

I’m having the exact same problem on my Mac.

Was this issue resolved? I’m in the same situation. Thanks!

Looking online, people recommend running Unity as an admin and disable any AV software: file access denied - Unity Engine - Unity Discussions

I tried the code and it worked fine. Windows 10 with Windows Defender here

P.S. Bumping threads is bad practice. Every time you bump an old thread a cat dies.

1 Like