How can I fix this?Please help me.
It normally happens when your filename and classname are not the same.
Which is exactly what the error message says.
Hey, I’ll tell you what’s wrong but first some advice on asking questions:
-
Use screen shots instead of taking pictures with your phone. There are many great tools to do that, I’m using Windows 10 and 11 and there is a great tool under Windows + Shift + S that let’s you crop a particular area of your screen.
-
I’m guessing from the looks of your inspector that you’re using a very old version of Unity. If you don’t have a particular reason to do this, don’t do this
-
Read error messages thouroughly and make sure you really don’t get what they say.
To answer your question:
The error message states that the name of your script doesn’t match the file name.
When creating MonoBehaviour or ScriptableObject scripts make sure that the file and class name match.
So in this case GroundCol
class should be in a GroundCol.cs
file.