MonoBehavior and other errors

Hello,

I am using Unity 2019.3.15f1. I am getting the “No MonoBehavior scripts in the file, or their names do not match the file names.” error. I checked, the class name matches with the code in VS.

I am also seeing this error: “Win32Exception: ApplicationName=‘C:\Program Files\Unity\Editor\Data\Tools\RoslynScripts\unity_csc.bat’, CommandLine=’/noconfig @Temp/UnityTempFile-4791d6c2383e54f41a3cfcc303346563’, CurrentDirectory=’’, Native error= Access is denied.” I can provide the full stacktrace if needed.

I have tried reimporting assets, making sure that VS has the Unity plugin, deleting and reinstalling Unity, rebooting my PC, making sure that Introducer is included in the project from VS, deleting all sln and csproj files, I am running out of ideas.

For what it’s worth, Unity Hub wouldn’t install the latest version, I had to do it manually.

Thank you for your help!

Hi Ryan,

Does the file name match the class name inside the file? For example, is the NumberWizard class inside the NumberWizard.cs file?

Also please watch lecture “Fixing Visual Studio Problems” (currently #7).

Hi Nina,

The file name matches, Introducer.cs is the filename and the class is Introducer.

I’ve rewatched Fixing Visual Studio Problems. Visual Studio 2019 Tools for Unity is installed, the file is included in Solutions Explorer, Visual Studio is up to date.

When exactly did the issue occur? Once you started Unity? Or did you do something else?
Do you have a firewall or an antivirus program that could be blocking Unity? Where did the error message appear? In Unity or VS?

The MonoBehavior error first appeared as I was going through the lesson. Then, as I was trying to fix it, following the various steps/hints on this forum, the Win32Exception error began to appear when I started Unity, in the console of Unity. I don’t believe I have a firewall or antivirus program blocking Unity, but I will double check.

Yeah, I’m not seeing any issues with firewalls/antivirus. But I did just get a popup to update to 2019.4.0f1 so I will try that.

Edit: Updated Unity, now I am getting these errors in addition to the MonoBehavior


So I’ve tried a few other things, then deleted everything and tried to start fresh. Now I’m getting this error, which appears no matter what directory I’m pointing to.

I tried to find the error and a potential solution.

Do you use other characters but A-Z, a-z, 0-9 in your path and folder names for Unity, VS or your project? See here:

No, the only non alphanumeric characters I use are in the spaces in the project name “My Block Model”.

I’ve just notived the error message in your last screenshot. Last time, I had my mouse over it, and the info box covered the error message.

Please try what people suggested in this thread:

https://forum.unity.com/threads/error-launching-the-editor-the-application-path-does-not-excist.692038/

I followed those instructions and am now running a fresh install that is able to open and create new projects. However, I’m still getting the Win32 error (pasted in part below) and the MonoBehaviour problem.

I have tried running as administrator and turning on permissions for access for unity_csc.bat at C:\Program Files\Unity\Editor\Data\Tools\RoslynScripts, that didn’t seem to make any difference either. I’m certain there are no special characters in the filepath.

The Win32 error, again, is this:
Win32Exception: ApplicationName=‘C:\Program Files\Unity\Editor\Data\Tools\RoslynScripts\unity_csc.bat’, CommandLine=’/noconfig @Temp/UnityTempFile-db1f82cf5569f3d4bb3c580e1777cb17’, CurrentDirectory=’’, Native error= Access is denied.

Thank you for helping!

Did you start Unity with administration rights? If so and if the issue persists, I would suggest to report a bug to Unity via Help > Report a Bug.

I did. I’ll report a bug. This is frustrating, but thank you for your help.

This topic was automatically closed after 2 days. New replies are no longer allowed.

Privacy & Terms