- Home /
Unity 5- "no Monobehaviour scripts in the file" message
It seems Unity 5 does not like any scripts that don't derive from Monobehaviour- my editor scripts, along with any custom classes and the like, don't seem to be compiling. All of these scripts have the message- no monobehaviour scripts in the file, or their names do not match the file name. This occurs with the example project editor scripts as well. I've done a bit of searching, and re-installed Unity with the downloader, but so far I'm quite at a loss. Thanks so much for your help!
Having the same problem using examples from a Unity tutorial book.
Answer by LMan · Mar 15, 2015 at 12:39 AM
It would seem that I was mistaken- the message "no monobehaviour scripts in the file" does appear on all classes not inheriting from monobehaviour, but they do compile. My scriptable object came un-associated from it's custom inspector, and that made me think the scripts were not functioning. I re-generated the scriptable object and it is now functioning correctly.
@L$$anonymous$$an Can you write what exactly you did (please step by step - I'm beginner).
I have similar problem but for every script in my project (even new ones): http://i.imgur.com/ohrtJIe.png
@tecbug - I'm afraid you have a different problem than I did. Unity was behaving as it should for me- I just misunderstood what was going on. Your screenshot shows that Unity is not behaving as it should for you.
You might try deleting the library folder to trigger a project rebuild, or re-installing Unity. $$anonymous$$ake a backup of your project folder first, of course.
I've submitted it as a bug last week: https://fogbugz.unity3d.com/default.asp?747645_qubgoo9s9qgrshr4 But still no answer. How fast they usually respond?
You may not get one. Bugs need to be prioritsed and some dont even get deal with by the next release. If you are 'lucky' lots of people will have the same problem and it'll be addressed faster.
Uhm, you have compiler errors in your scripts. If there are errors the compiler can't compile your scripts and therefore non of your classes will work until you fix your errors. All your scripts are compiled into a single assembly. If the compilation can't be completed due to an error nothing will work.
Did you really file a bug report about that? .....
btw, you didn't include the aaa.cs file in your project. You only included the metafile which results in another error when i was first loading your project as the editor recognises the metafile and complains that no asset with that name was found so it removed the metafile as well.
edit
Both of your errors are related to this line:
PlayerPrefs.SetInt (IsTheGameStartedForTheFirstTime, 1);
IsTheGameStartedForTheFirstTime is a method and you pass it to the SetInt method. SetInt requires a string as first parameter. This fixed the errors:
PlayerPrefs.SetInt ("IsTheGameStartedForTheFirstTime", 1);
Next time you might want to check your errors first and if you can't solve the errors, feel free to post a question in the help room.
@Bunny83 I've asked for help in 3 forums and they all said that's Unity error and I should reinstall Unity (what I did - didn't help) and report this as a bug. As a newbie I did so. You're first one that really helped me on this. Thank you.
I have the same problem! At the first time , all the scripts said " no monobehaviour scripts in the file" .Create a new script ,it happens too!Then ,I try to delete some scripts which maybe cause this error! Then this error only appears on the scripts which is not inheriting from monobehaviour. Other demos downloaded from the web also have the similar problem. This trouble me a few days ,if you get this ,please help me. I should be glad if you have the time to email me (shuguang_4316@163.com),thanks a lot .by the way , my English is very poor! :)
Answer by Ignorant · Jul 08, 2016 at 12:32 AM
Happen to me as well. It was super annoying. The fix was weird as hell. I had a help class at the top of the file. This help class was basically a touple with two public variables - nothing wrong with it. Except when I moved it other file all started to work again.
Your answer
Follow this Question
Related Questions
Scriptable Objects, how to force Include in Compile / Build without referencing it in the scene? 1 Answer
How can I get complete path of a sprite? 1 Answer
Filling list with editor scripts is empty on Play 1 Answer
BCE0044 erro only shows when trying to build .apk 0 Answers
Editor script variables resetting after restarting Unity 2 Answers