I am fully aware this issue has been brought up before but could not find a solution that worked in my case. I am using Unity Version Unity 2019.2.9f1 with visual studio 2019 community. Any script I have made or any new script I create gives the warning of “No Monobehaviour Script in file, or their names do not match the file name.” I have un-installed all versions of unity, and visual studio, and re-installed Unity 2019.2.9f1 with visual studio 2019 community. I have downloaded and installed all available .NetFrameworks on the microsoft site. I have created multiple new projects and this occurs on every one. I have refreshed and re-imported all assets. I have made sure my computer local region was set to english. I have disabled my norton antivirus. I have disabled all non microsoft applications. I am very confused and frustrated. Please help if you have any ideas I will try them.
Have you tried it in an older version?
No, not yet, but I will now and let you know.
No success. I downloaded 2018.4.11f1 with visual studio 2017 and it shows the same warning. I did get a new error when opening visual studio but I did not get this error in visual studio 2019 and had the same monobehaviour problem so I do not know how they could be related. I will post a screenshot of the error. Also, I received another error when I tried to load up the new script. I pasted that below as well. I followed the cookie trail that the first error recommended and found a red error in the log that I also pasted below. Thank you for your interest in helping.
bump
I am now considering doing a complete computer reset. Can anybody give me a reason to not do this?
Really lonely on this topic
I’m afraid something like this is outside the purview of what most Unity users would have an intuition about. Unless you trip across someone else who has encountered this same issue and fixed it, I think this would be best suited for contacting the support team directly.
That same thing happened to me. My scripts were doing fine and suddenly, I got this weird error message in a new script
No Monobehaviour Script in file, or their names do not match the file name."
Actually after re-importaing all, quitting code and back. All my scripts display the same error.
OK so here is what fixed it. There was a tiny code error (missing a semi colon in one of the scripts) and that trigeered this error message in the inspector.
The compile error was in red in the bottom of the IDE and I am just beginning with unity and di not pay attention…
So make sure there is no compile error anywhere as the error message you got in the inspector is not really clear…
I hope that helps.