Search Unity

Errors When Creating Scripts - Error CS0589 Internal Compiler Error During Parsing

Discussion in 'Scripting' started by clamum, May 14, 2017.

  1. clamum

    clamum

    Joined:
    May 14, 2017
    Posts:
    61
    I am new to Unity (though not programming; I'm a .NET developer by profession) and am following along to the "Unity Game Development" course on Udemy and have just created my first C# script for the project I'm working on. It simply has the code "transform.Translate(Vector3.left * (20 * Time.deltaTime));" in the Update() method.

    Well, I am seeing multiple errors. There's the "Error CS0589: Internal compiler error during parsingSystem.NullReferenceException: Object reference not set to an instance of an object" error in the Unity status bar on the bottom, the "No MonoBehavior scripts in the file, or their names do not match the file name" message on the right side under the Object Import Settings. Of course I see that "All compiler errors have to be fixed" message when trying to play the game.

    I've tried using MonoDevelop and Visual Studio 2017 Community to no avail. I've tried running Unity as Administrator and no change. I even shut off UAC (I'm using Windows 10) and no change. I'm not running any antivirus besides whatever default Windows 10 comes with (Defender?).

    So it's pretty frustrating. It looks like I can't do anything with scripts until the error gets resolved. Any help would be greatly appreciated. I've attached a screenshot of Unity with the errors in the bottom status bar and to the right when the script has been clicked on.

    Untitled-1.png
     
  2. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    Don't name the class Object, or at least wrap it in a namespace. That should solve the problem.
     
    benmore99 and clamum like this.
  3. clamum

    clamum

    Joined:
    May 14, 2017
    Posts:
    61
    I was just headed back here to post that I apparently solved it. Yep, I created a new script and used the default name ("NewBehaviorScript" I believe) and that fixed the problem. Huh.

    Kinda weird how Mark Price named the script "Object" in the course I'm watching and it worked for him. Whatevs, it works now! Thanks for your reply Suddoha.
     
  4. JustinMeyer

    JustinMeyer

    Joined:
    Aug 22, 2017
    Posts:
    1
    Thx. I'm doing the same course and had the same problem.
     
  5. m3mataei

    m3mataei

    Joined:
    Oct 24, 2017
    Posts:
    2
    oh man this is insane i mean its just a name WTF!
     
  6. ricardoperovano

    ricardoperovano

    Joined:
    Jan 4, 2018
    Posts:
    1
    I think its because the Unity Version he is using