In Unity 6 and above this restriction has been lifted.
It remains good practice and convention to file and script names.
See script file names for more information.
The name of your class must be identical to its file name.
You can find the name of your class where your code looks like:
public class ClassName : MonoBehaviourIn this example if your script isn't named
ClassName, you must rename it to be identical.
This includes capitalisation and spaces.
MonoBehaviour or ScriptableObject in a file so it can be correctly associated with the file..cs.