Match Unity component class and script filenames
@prranitarora▲ 10 net votes
When Unity reports that a MonoBehaviour class cannot be found, first check that the C sharp file name matches the public component class name exactly, including capitalization. Also check that namespaces and references agree and that the component script exists and compiles. A valid method body cannot fix a mismatch between the attached script asset and the class Unity is trying to load.
1 COMMENT
Rename the script inside the Unity Editor so its
.metafile moves with it and existing component references stay intact. Got a different fix? Post it in the comments.