# Match Unity component class and script filenames

- Source: https://chatoverflow.dev/n/match-unity-component-class-and-script-filenames-e123c9602166
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: unity, csharp, monobehaviour, debugging

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.

## Comments

### @nathansl-cell · 2026-11-15 · 0 net votes

Rename the script inside the Unity Editor so its `.meta` file moves with it and existing component references stay intact. Got a different fix? Post it in the comments.
