Why C# scripts doesn't work?

Today I create a new Project , then my console prints :

Couldn’t load the script “activatetrigger” because its file name doesn’t match the class name.
Please make sure the file name of the script is the same as the class defined inside it.
(Filename: …..\Runtime\Mono\MonoScript.cpp Line: 384)

Couldn’t load the script “watersimple” because its file name doesn’t match the class name.
Please make sure the file name of the script is the same as the class defined inside it.
(Filename: …..\Runtime\Mono\MonoScript.cpp Line: 384)

Couldn’t load the script “mouselook” because its file name doesn’t match the class name.
Please make sure the file name of the script is the same as the class defined inside it.
(Filename: …..\Runtime\Mono\MonoScript.cpp Line: 384)

Couldn’t load the script “combinechildren” because its file name doesn’t match the class name.
Please make sure the file name of the script is the same as the class defined inside it.
(Filename: …..\Runtime\Mono\MonoScript.cpp Line: 384)

Couldn’t load the script “meshcombineutility” because its file name doesn’t match the class name.
Please make sure the file name of the script is the same as the class defined inside it.
(Filename: …..\Runtime\Mono\MonoScript.cpp Line: 384)

All the *.cs scripts are not work then.

For example: Mouselook.cs as a component in “first person controller” even not showing public variable at all.

What could I do?

As the error message says, the class name has to be the same as the file name,
e.g. your file is called activatetrigger, so the class name (inside your script) has to be the same :

public class activatetrigger : MonoBehaviour
{

}

I had it too back in 2.5. It should be fixed in Unity 2.5.1f5.

So updating to 2.5.1 should fix your problem.

Oh,thanks^I’m gonna to fix it now> :arrow:

Upgrading fixed it temporarily but now the errors are back. How do we make it stop?

Are you running the editor on Windows?

Hey zambezi/andeeee,

What if you are using javascript??? Because i get the same error 384 and im not using any classes.The GUI system,particle system,and one of my enemy characters doesnt work. I upgraded to 2.5.1 too and still get the same issue. I really need to get this project fixed…Im going broke here and im :frowning: struggling!!! Help!

P.S im using the windows version and these errors are coming up in the build log after i publish the game.

For C#, the filename needs to match the name of a class within the file. The match must be exact, with correctly capitalised letters.

For JS, the issue shouldn’t arise - you should contact support@unity3d.com if this is causing problems for you.

exactly same.
include this:

file name “AAA”

class name :public AAA : MonoBehaviour {
...
}

Unity thought it is error.

class name :public AAA: MonoBehaviour {
...
}

is right[/code]

i always use visual studio and i follow along with a tutorial i did the code right but i have nothing but errors is there anything i need to modify in in visual studio

Instead of necroing a 10 year old post, post your own question and show some code and copy and paste the error. It’s impossible to help you with what you asked without more details.

1 Like