title: Unity3d no Monobehaviour scripts in the file, or their names don't match the file name
body: <p>Hello everyone I've been working on my first game and suddenly I got this error and cannot run the game, I already installed the new version of unity but it persists. I see it can be caused for several reasons but had no luck so far, do you know the most probable causes and how to fix it?</p>
  
  <p>When I select the scripts the only one where I do not get this error is the following:</p>
  
  <pre><code>using UnityEngine;
  using Assets.Code.States;
  using Assets.Code.Interfaces;
  
  public class StateManager : MonoBehaviour 
  {
      private IStateBase activeState;
  
      void Start () 
      {
          activeState = new BeginState (this);
      }
  
      void Update () 
      {
          if (activeState != null)
              activeState.StateUpdate();
      }
      void OnGUI()
      {
          if (activeState != null)
              activeState.ShowIt ();
      }
      public void SwitchState(IStateBase newState)
      {
          activeState = newState;
      }
  }
  </code></pre>
  
  <p>But for example here I get the error:</p>
  
  <pre><code>using UnityEngine;
  using Assets.Code.Interfaces;
  
  namespace Assets.Code.States
  {
      public class BeginState : IStateBase
      {
          private StateManager manager;
  
          public BeginState (StateManager managerRef)
          {
              manager = managerRef;
              Debug.Log ("Constructing BeginState");
              Time.timeScale = 0;
          }
          public void StateUpdate()
          {
              if (Input.GetKeyUp(KeyCode.Space))
              manager.SwitchState(new PlayState (manager));
          }
  
          public void ShowIt()
          {
              if (GUI.Button (new Rect (10, 10, 150, 100), "Press to Play"))
              {
                  Time.timeScale = 1;
                  manager.SwitchState (new PlayState (manager));
              }
          }
      }
  }
  </code></pre>
  
  <p>And so on with every other script.</p>
  
  <p>I've already installed a newer version of unity3d, uninstalled the antivirus, checked the file names but the error persists. I also do not have any class in a namespace..</p>