New C# scripts used to derive from monobehavior but don't anymore,New scripts are not monobehaviours despite explicitly extending MonoBehaviour 2018.2.21f1
When I started my project, new scripts were working correctly, however, when I create a new script now, Unity complains that there are "No MonoBehaviour scripts in the file, or their names do not match the file name." This is perplexing because I have not been doing anything differently than before when it was still working correctly. The file names match the class names, and all newly created scripts should extend MonoBehaviour because they use " : MonoBehaviour" in the class declaration. When I try to copy existing scripts to the new scripts and change the name they have the same problem, but strangely, the original scripts still work normally. As a result of this, I have not been able to create new scripts which Unity will allow me to attach to game objects. I am using Unity 2018.2.21f1 because it is being used for a class I am in, and I am using Visual Studio 2017. I have seen a lot of posts about similar problems, but I have tried all the solutions I have found short of uninstalling Unity, because I still need it for my class.
Answer by jonathanskidmore1 · Jun 04, 2019 at 02:07 PM
Although I would still like to know what the problem was and how to solve it, I was able to get a new script working by creating it in Visual Studio and importing it as a new asset, so this issue is slightly less pressing.