A large number of my editor scripts have suddenly started displaying the dreaded “No MonoBehaviour scripts in the file…” error in the Inspector although I only modified one of them recently. That script apparently isn’t compiling (it doesn’t show up under “Window”) despite not returning any errors, and despite having the proper name (I copied and pasted the filename directly into the class name in the file, so that can’t be the problem). It might have been caused by renaming the file at some points, but deleting the file entirely and then recreating it didn’t solve the problem.
Anyone know what might be causing this?
Restart Unity. Reimport the script. If none of that works I don’t know.
Also apart from the file name being same as the class make sure you got MonoBehaviour inherited in your class and that it’s the first class in the file (though I guess you have looked into that).
It inherits from EditorWindow so I assume that would cover it.
I’ve restarted Unity and also reimported the script that’s probably causing the problem. Nothing works.
Anyone know the magic procedure to solve something like this?
If it’s inheriting from EditorWindow, it’s not a MonoBehaviour. Where is it showing “no monobehaviour in file”?
It’s showing that in the Inspector view for most of the editor scripts (altho I only modified one of them). The one I modified doesn’t show up under the Window tab since it evidently didn’t compile despite the lack of error messages, but the other scripts do show up under Window and they still run.
Anyone know what needs to be done to get rid of this problem? It makes it impossible to compile certain scripts.
You need to roll back. You deleted something that a lot of stuff inherits from, or broke a script that prevents a lot of things? or added a bad asset that obnoxiously doesn’t use namespaces?
Lots of reasons. I would roll back. I do roll back when unidentifiable things occur. I cannot help you.
Unmodify it ASAP then.
I am getting the exact same message on all my scripts (screenshot below) on one of my computers but not on another. I have tried creating this project in every version of Unity at the 2018 level and never had the problem on version 5.
It does not matter what code I put in the file I keep getting this message and cannot continue. Clearly the file name and class names are identical. Can anyone help beyond what is in the forums to date?
thanks!
Close Unity and delete the Library folder in your project. When you load Unity again it will reconstruct it. This often fixes things. Do it on a copy of the project.
Report your version number of Unity etc. Is it 2018.2 f2?
I have created 2 test projects. One in Unity 2018.2.0f2 and one in 2018.1.8f1. Both have the 2 dummy scripts. I have deleted the library folder and see the exact same message in both versions. I am stumped. thanks.
I’d recommend reinstalling Unity, but make sure visual studio is closed etc. Failing this, please use the bug reporter from inside Unity.
Aside from what Hippocoder has said, I would add that some of my scripts still have this problem and yet it doesn’t seem to be doing any harm anymore. Initially it prevented some scripts from compiling, but it later just settled into an ambiguous state where the problem is still listed but the scripts compile and work fine. I would restart Unity and see if the scripts at least compile after that. I wouldn’t do anything drastic until you’ve confirmed that it definitely won’t resolve on its own.
Thanks. The reinstall yielded the same results so I have reported the bug. If I receive a solution that would help others, I will post it here.
