- Home /
'no monobehaviour scripts in the file' -corruption not solved by matching file and class names.
Something happened to my project and a lot of scripts started to suddenly not be usuable due to "unity no monobehaviour scripts in the file or their names do not match the file name". Although they all inherit from Monobehaviour and their filename is the same as class name. Ive tried deleting the .meta files.
The way i solve it is by creating a new file. CopyPasting all content to the new file. Deleting the old file and renaming the new file.
What is going on here?!!!
EDIT - I found an easier way to fix this. I only need to rename affected files to the exact same name and press enter. After recompiling they work. It makes me thing som weird invisible characters where added to the files name?
Your answer
Follow this Question
Related Questions
Failed to unpersist: MonoBehaviour ID and then unity destroys our scene. 3 Answers
I need help writing a simple script for making an object face the mouse in 2D. 2 Answers
ReImport in c# of GameObjects only for Scene Objects, not assets? 1 Answer
UnityEditor on Tag Update event 0 Answers
Why unity does not opening ? 0 Answers