Search Unity

Unity Win32Exception: Access is Denied. unity_csc.bat

Discussion in 'Editor & General Support' started by ian-coetzer, May 23, 2019.

  1. ian-coetzer

    ian-coetzer

    Joined:
    Oct 11, 2015
    Posts:
    25
    Good morning

    I have just installed Unity 2019.1 latest build and whenever I open a new project I receive two of these error messages in the console. This happens even before I try and play an empty project.

    Win32Exception: ApplicationName='C:\Program Files\Unity\Editor\Data\Tools\RoslynScripts\unity_csc.bat', CommandLine='/noconfig @temp/UnityTempFile-fa81a2f614e027340a67c767a28a46ea', CurrentDirectory='', Native error= Access is denied.

    Win32Exception: ApplicationName='C:\Program Files\Unity\Editor\Data\Tools\RoslynScripts\unity_csc.bat', CommandLine='/noconfig @temp/UnityTempFile-fa81a2f614e027340a67c767a28a46ea', CurrentDirectory='', Native error= Access is denied.
    System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Diagnostics.Process.Start () (at <c9226b2f33b7421e85bb391f94075e49>:0)
    (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
    UnityEditor.Utils.Program.Start (System.EventHandler exitCallback) (at C:/buildslave/unity/build/Editor/Mono/Utils/Program.cs:44)
    UnityEditor.Utils.Program.Start () (at C:/buildslave/unity/build/Editor/Mono/Utils/Program.cs:28)
    UnityEditor.Scripting.Compilers.MicrosoftCSharpCompiler.StartCompilerImpl (System.Collections.Generic.List`1[T] arguments, System.String argsPrefix) (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/MicrosoftCSharpCompiler.cs:106)
    UnityEditor.Scripting.Compilers.MicrosoftCSharpCompiler.StartCompiler () (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/MicrosoftCSharpCompiler.cs:141)
    UnityEditor.Scripting.Compilers.ScriptCompilerBase.BeginCompiling () (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/ScriptCompilerBase.cs:60)
    UnityEditor.Scripting.ScriptCompilation.CompilationTask.QueuePendingAssemblies () (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CompilationTask.cs:286)
    UnityEditor.Scripting.ScriptCompilation.CompilationTask.Poll () (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CompilationTask.cs:186)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.ScriptAssembly[] scriptAssemblies, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings scriptAssemblySettings, System.String tempBuildDirectory, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.CompilationTaskOptions compilationTaskOptions, UnityEditor.Scripting.ScriptCompilation.EditorCompilation+CompileScriptAssembliesOptions compileScriptAssembliesOptions) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1307)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileCustomScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings scriptAssemblySettings, System.String tempBuildDirectory, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.BuildTargetGroup platformGroup, UnityEditor.BuildTarget platform) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1225)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileCustomScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.BuildTargetGroup platformGroup, UnityEditor.BuildTarget platform) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1218)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface+<CompileCustomScriptAssemblies>c__AnonStorey4.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:295)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface.EmitExceptionAsError[T] (System.Func`1[TResult] func, T returnValue) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:97)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:CompileCustomScriptAssemblies(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)


    Win32Exception: ApplicationName='C:\Program Files\Unity\Editor\Data\Tools\RoslynScripts\unity_csc.bat', CommandLine='/noconfig @temp/UnityTempFile-553835d7118366342977fc6fab842167', CurrentDirectory='', Native error= Access is denied.
    System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) (at <c9226b2f33b7421e85bb391f94075e49>:0)
    System.Diagnostics.Process.Start () (at <c9226b2f33b7421e85bb391f94075e49>:0)
    (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
    UnityEditor.Utils.Program.Start (System.EventHandler exitCallback) (at C:/buildslave/unity/build/Editor/Mono/Utils/Program.cs:44)
    UnityEditor.Utils.Program.Start () (at C:/buildslave/unity/build/Editor/Mono/Utils/Program.cs:28)
    UnityEditor.Scripting.Compilers.MicrosoftCSharpCompiler.StartCompilerImpl (System.Collections.Generic.List`1[T] arguments, System.String argsPrefix) (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/MicrosoftCSharpCompiler.cs:106)
    UnityEditor.Scripting.Compilers.MicrosoftCSharpCompiler.StartCompiler () (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/MicrosoftCSharpCompiler.cs:141)
    UnityEditor.Scripting.Compilers.ScriptCompilerBase.BeginCompiling () (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/ScriptCompilerBase.cs:60)
    UnityEditor.Scripting.ScriptCompilation.CompilationTask.QueuePendingAssemblies () (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CompilationTask.cs:286)
    UnityEditor.Scripting.ScriptCompilation.CompilationTask.Poll () (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CompilationTask.cs:186)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.ScriptAssembly[] scriptAssemblies, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings scriptAssemblySettings, System.String tempBuildDirectory, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.CompilationTaskOptions compilationTaskOptions, UnityEditor.Scripting.ScriptCompilation.EditorCompilation+CompileScriptAssembliesOptions compileScriptAssembliesOptions) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1307)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScripts (UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings scriptAssemblySettings, System.String tempBuildDirectory, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+TargetAssembly[]& notCompiledTargetAssemblies, System.String[]& notCompiledScripts) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1210)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScripts (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.BuildTargetGroup platformGroup, UnityEditor.BuildTarget platform) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1102)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface+<CompileScripts>c__AnonStorey3.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:288)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface.EmitExceptionAsError[T] (System.Func`1[TResult] func, T returnValue) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:97)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:CompileScripts(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)
     
    htdev678 likes this.
  2. tsibiski

    tsibiski

    Joined:
    Jul 11, 2016
    Posts:
    604
    What happens if you right click the Unity.exe and choose "Run as Admin"? Same error?
     
    htdev678 and Joe-Censored like this.
  3. ian-coetzer

    ian-coetzer

    Joined:
    Oct 11, 2015
    Posts:
    25
    Yes same error :(
     
    Deleted User and htdev678 like this.
  4. tsibiski

    tsibiski

    Joined:
    Jul 11, 2016
    Posts:
    604
    Try finding this file in your file explorer: C:\Program Files\Unity\Editor\Data\Tools\RoslynScripts\unity_csc.bat

    Next, right click the file, and select "Open With". Choose a text editor to open it, as double clicking a bat file will try to execute the script by default.

    See if you manually navigating to the file results in the same/similar access denied error. Sometimes, access denied errors can even occur when the file simply doesn't exist, so it's good to make sure it even exists.

    If you do not receive the error, try to change the file permissions on the top level folder "C:\Program Files\Unity\" to allow read/write for everyone, and not just admin. Choose to cascade these changes to all child folders and files. Then, try all of this again and see if it still errs.
     
    htdev678 likes this.
  5. ian-coetzer

    ian-coetzer

    Joined:
    Oct 11, 2015
    Posts:
    25
    I tried to grant everyone full access and I can definitely edit the unity_csc.bat file now and save it, however unity is still complaining:
    Win32Exception: ApplicationName='C:\Program Files\Unity 2019.3.0a3\Editor\Data\Tools\RoslynScripts\unity_csc.bat', CommandLine='/noconfig @temp/UnityTempFile-2f8d3f5f0c51ba547a3710b9bb4c5d70', CurrentDirectory='', Native error= Access is denied.


    When I add a new "C#" script and try and attach it to a gameobject it crashes saying that the script class name cannot be found.

    I am 100% sure that the class name for example MyScript matches the file name MyScript ...
     
    htdev678 likes this.
  6. tsibiski

    tsibiski

    Joined:
    Jul 11, 2016
    Posts:
    604

    So the latter issue will occur when your Unity fails to make a .meta file version of your newly created .cs script. It sounds like there is something is fundamentally messed up with your Unity. You may want to try reinstalling it entirely, or try a different version. I don't know what else could be going wrong here, but this isn't normal.
     
    htdev678 likes this.
  7. ian-coetzer

    ian-coetzer

    Joined:
    Oct 11, 2015
    Posts:
    25
    I think I have figured it out, I am using COMODO anti virus, and after disabling the COMODO internet helper service it is working ... I remember having an issues with BLENDER and turning off the COMODO internet helper server that issues was also fixed, but I have turned it on since then because I no longer play with BLENDER.
     
    htdev678 likes this.
  8. ian-coetzer

    ian-coetzer

    Joined:
    Oct 11, 2015
    Posts:
    25
    Can you confirm that this is truly what is messing up Unity as well? Using an anti virus app such as COMODO?
    Surely Unity is signed and properly developed??
     
    htdev678 likes this.
  9. tsibiski

    tsibiski

    Joined:
    Jul 11, 2016
    Posts:
    604
    It does not need to be a signing issue. Last year, I and other encountered an issue with Nord VPN that caused Unity to load into a blank grey screen with no content. Another issue in Nord VPN caused a SIGTERM error where the vpn service and Unity tried to simultaneously access a single address in memory, resulting in a crash. The issue seemed to be around security features in the service.

    So VPN's and Antivirus applications do a lot of things that can potentially interfere with applications. A game engine puts its fingers into a WHOLE lot of pies in a computer. Things that a normal application would never ever need to touch. This raises red flags for antiviruses which reasonably interpret this access as being a virus or malware.

    The options are to report to your antivirus that Unity is a legitimate application, and they should whitelist it so that their application stops interfering. Or alternatively, simply turn off the software that is interfering.
     
    htdev678 and ian-coetzer like this.
  10. ian-coetzer

    ian-coetzer

    Joined:
    Oct 11, 2015
    Posts:
    25
    Hi, thank you for your reply. At least I found the cause and I can carry on playing with Unity!
     
    htdev678 likes this.
  11. spookyjoker

    spookyjoker

    Joined:
    May 19, 2019
    Posts:
    2
    hey i am also having the same problem i can't fix it please help
     
    htdev678 likes this.
  12. spookyjoker

    spookyjoker

    Joined:
    May 19, 2019
    Posts:
    2
    i have no antivirus enable
     
    htdev678 likes this.
  13. sherozsharipov96

    sherozsharipov96

    Joined:
    Nov 15, 2019
    Posts:
    2
    Guys how do you fix the problem. İ am get crazy from this problem reinstall 3, 4 version of Unity.
     
    htdev678 likes this.
  14. cse43208

    cse43208

    Joined:
    Dec 18, 2019
    Posts:
    1
    any updates ? i stoped my antivirus but still the same problem
     
    htdev678 likes this.
  15. sahin52

    sahin52

    Joined:
    Jan 21, 2020
    Posts:
    1
    Same issue, tried reinstalling Unity 3-4 times but doesn't work. I think it is not about Unity but about csharp or other things. But couldn't find a solution. Drove me nuts
     
    htdev678 likes this.
  16. mehmetcc

    mehmetcc

    Joined:
    Aug 6, 2017
    Posts:
    2
    anyone find a solution?
     
    htdev678 likes this.
  17. theboyhasnoname

    theboyhasnoname

    Joined:
    Apr 23, 2020
    Posts:
    1
    there is no solution to this i guess... it just wont fix having same issue and it just wont fix
     
    htdev678 likes this.
  18. htdev678

    htdev678

    Joined:
    Jun 5, 2020
    Posts:
    1

    do all the things, INSTALL UNITY HUB AS RUN ADMIN & INSTALL AGAIN AND AGAIN BUT STILL NOTHING HAPPEN..... EMAIL THAT ISSUE BUT TO UNITY BUT STILL NO SOLUTION...
     
  19. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Have you tried launching the hub/editor as admin, not just the install? Access Denied errors are usually user related (lack of access rights for the user).
     
  20. ALCapone_1867

    ALCapone_1867

    Joined:
    Jun 6, 2020
    Posts:
    1
    it works with unity 2018 with me
     
  21. olivecrow

    olivecrow

    Joined:
    Jul 15, 2017
    Posts:
    24
    If there is nothing wrong with the path of csc.exe written in "unity_csc.bat", it is not a direct cause.

    In this case, most of the errors occur because the compilation was not completed in other parts.

    If you have reinstalled the editor, check to see if all the packages which were in original project have imported from the Package Manager, and see if there is a compilation error in the script you have written.

    Even if the manifast.json file contains information about the package, it is considered unimported unless the package manager within the editor has a green checkmark.

    This is often what happens when compilation errors occur.
     
  22. AdamOosthuizen

    AdamOosthuizen

    Joined:
    Feb 7, 2018
    Posts:
    7
    Hi there, still getting this error after multiple reinstalls of editor and hub and changing access settings in the program files location of the editor.
    I have tried uninstalling hub and running Unity from cmd shell but to no avail either.
    I have also checked and double checked the unity_csc.bat file.

    I am using 2019.4.19f1 and have been blocked on a project for a week now.

    Is anyone experiencing issues with this version in particular?

    Please advise
     
  23. olivecrow

    olivecrow

    Joined:
    Jul 15, 2017
    Posts:
    24
    I am using 2020.2.3f1, but the problem occurred very often, so I tried many solutions.

    The most effective thing was to open the package manager, delete the URP package and import it again.

    In addition, I intentionally caused a compilation error in my script, then corrected it again and repeatedly made the editor recompile the script. At this time, when I got error messages on the console saying that I couldn't find the namespace of the package I was using in the script, I deleted the packages and repeatedly imported them again.
     
  24. olivecrow

    olivecrow

    Joined:
    Jul 15, 2017
    Posts:
    24
    I have tried various versions such as 2020.2, 2020.1, 2019.4, but most of them have been solved by this way.

    Considering that the same problem occurred even after re-installing both the Unity Hub and the editor, there seems to be a cause of a crash among package managers or packages.
     
  25. olivecrow

    olivecrow

    Joined:
    Jul 15, 2017
    Posts:
    24
    Okay, I figured out the cause of this problem. My guess is wrong and what I wrote above is just a temporary measure.

    My cause was an anti-virus program installed on my computer. After removing this program, the problem was solved.

    In addition, the same problem did not occur after recompilation was attempted in the method described above to solve the project that still had problems.
     
  26. unity_18melkumyanm

    unity_18melkumyanm

    Joined:
    Mar 27, 2020
    Posts:
    7
    I don't have any antivirus software on my computer other than windows defender and I'm still running into the same issue. Even new unity projects have the same issue. Do you have any idea what else I should try? I tried disabling windows defender but still had the same problem. I'm using Unity 2019.4.21f1 if that helps. This bug has been keeping me from working on a class project for the past week and any help would be super appreciated. Thank you!
     
    Last edited: Feb 26, 2021
  27. tsibiski

    tsibiski

    Joined:
    Jul 11, 2016
    Posts:
    604

    Go into your task manager and gradually kill all non-critical processes. Start with non-Windows processes (like from apps you downloaded). After each one, launch Unity. By process of elimination, you will eventually find the process that is interfering with Unity. It doesn't have to be an anti-virus for this issue to occur, but it just seems like anti-viruses were putting their fingers in the right pie to interfere with Unity.
     
  28. unity_18melkumyanm

    unity_18melkumyanm

    Joined:
    Mar 27, 2020
    Posts:
    7
    procceses.JPG procceses.JPG
    I've gone through and killed basically every process I can and I'm still getting the error, unfortunately. I've attached a screenshot of all the processes I have left. Most of them are either windows processes or can't be killed. Do I have any other options left? Is there a way to directly contact unity support? This error is pretty frustrating. Thank you for your help!
    EDIT: I'll also mention that I've tried installing Unity on a separate drive and that didn't fix the issue either.
    EDIT2: Ok so it turns out that my error is slightly different than the one this post is for Mine says:
    Win32Exception: ApplicationName='R:\RemotePrograms\Unity\Editor\Data\Tools\RoslynScripts\unity_csc.bat', CommandLine='/noconfig @temp/UnityTempFile-516b4a37a94697b49b51d9e1e7eb4aa2', CurrentDirectory='', Native error= The system cannot find the file specified.
    It says "The system cannot find the file specified" instead of permission denied. That might be why the solutions from this post aren't working.
     
    Last edited: Feb 26, 2021
  29. Coderious

    Coderious

    Joined:
    Mar 28, 2020
    Posts:
    26
    Can someone help here I have the same issues for weeks, tried everything
     
  30. Somiethehomie

    Somiethehomie

    Joined:
    Jan 21, 2021
    Posts:
    1
    same error and no help from support. just built this PC with a 3080 and an i9900k this company is trash and there support sucks even more.
     
  31. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    If you're getting "access denied", that would normally be a user permissions issue, which Unity doesn't have any control over. Try to just run that batch file manually from a command prompt and see what happens.

    If the issue is instead "The system cannot find the file specified", first verify that the file exists. The last thread I helped with that had that error it ended up being a problem with their Windows install, where "cmd" (command prompt application) would fail to start. "cmd" is what Windows uses to execute batch files, since batch files are essentially just scripts for cmd. So I'd check that. If your problem is Windows related, again that isn't something Unity can fix.
     
  32. doo002

    doo002

    Joined:
    Apr 14, 2020
    Posts:
    1
    I've experienced the same problem and solved. Some security program blocked it.
    In my case it was virtual screen capture protection program.
    Uninstalled it and recompiled unity, it worked fine.
    And then reinstalled that security program, both worked fine.

    Try to find the similar candidate security programs and uninstall it.
     
  33. biogicfps

    biogicfps

    Joined:
    Mar 23, 2020
    Posts:
    3
    Process Lasso also affects this. Disabled and removed and fixes FYI
     
  34. fabriciopsyko

    fabriciopsyko

    Joined:
    Mar 15, 2023
    Posts:
    1
    Try to discover what the editor tried to do and was denied, and do this manually for it. I did it and worked for me. My editor tried to delete some parts of something calld Bee functions, I went there and deleted the whole directory called Bee, inside the project's directory, when I open the project the error were no more there.
     
    WolfDreamer and Rob21C_UK like this.
  35. Rob21C_UK

    Rob21C_UK

    Joined:
    Dec 16, 2021
    Posts:
    1
    I have just installed 2021.3.22f1 and the URP shader disappeared from the project and the Win32 error appeared stating it could not find a file in the Bee folder. Doing your fix worked, thank you.
     
    WolfDreamer likes this.