- Home /
The scripts file name does not match the name of the class defined in the script!
So, the file name of my C# MonoBehaviour script matches the class name exactly (including capitalization), but I'm getting the "The scripts file name does not match the name of the class defined in the script!" error when I drag it onto a game object in the editor. Has anyone seen this or have any thoughts?
Do you have more than one class defined in the script? Did you put the class in a namespace? (Namespaces don't work for $$anonymous$$onoBehaviours.) Can you post your filename and your script? (Remove the body of the script if you prefer not to share.)
hello I have similar problems. I put the class in a "namespace System.IO.Ports" because I need to use the serial port. But same error appears whether I add the namespace. Do you have any idea how to fix it?
Answer by JermAker · Mar 24, 2011 at 04:52 PM
Fixed by removing the namespace definition in the MonoBehavior.