The class defined in script file named 'ConnectGui' does not match the file name! JavaScript

Hi, I have seen similar problems with C# but I'm getting this problem using JavaScript. How do Where is the class definition within the script?

I.E. What is the JS equivilent of //CODE public class NewBehaviourScript : MonoBehaviour { //END CODE

Generally you don't need to declare the class yourself if it's going to be a MonoBehaviour, it's done implicitly, saving you from needing to rename it when you rename the file

if you do, it's

class Name extends MonoBehaviour {

Unity passes over the project and compiles all of the UnityScript (javascript) scripts into IL classes just like C# classes. The name of the synthetic class in the UnityScript assembly for that pass is the name of the javascript file without the .js. What you are saying makes me think that you perhaps changed the name of the file and Unity got confused or something as there are no explicit class definitions in UnityScript. Technically users of UnityScript should never see this error. Maybe you can try redragging the script reference or something.

Hey, thanks for the responses but I solved this myself. The problem was that I did a change to my game that broke it, and then I restored only the Assets folder of my backup, not the Library.

Thanks again, hope this helps some other n00b who has the same problem.

I’ll throw this in here too. I had this error when I mistakenly put an extension on my filename in my project browser. The file on disk was then called [file].js.js which confused Unity.