Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

"The name 'System' does not exist in the current context"

Discussion in 'Scripting' started by Huntertyavatar1, Sep 26, 2017.

  1. Huntertyavatar1

    Huntertyavatar1

    Joined:
    Sep 26, 2017
    Posts:
    5
    Hi, I'm a highschool student currently learning in a game design class. I've been getting CS0103 errors for things that shouldn't be getting them.

    For example:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine

    public class : MonoBehaviour

    All of them, except for the using command and public class, have the error CS0103 on them, as well as any functions I put below Update or Start.

    Mind you, the script will still work regardless if I put it on an object and play the scene. I just need to know what might be causing this so I can get these error messages off my dash.
     
  2. JoshuaMcKenzie

    JoshuaMcKenzie

    Joined:
    Jun 20, 2015
    Posts:
    916
    you're missing a semi colon
     
  3. Huntertyavatar1

    Huntertyavatar1

    Joined:
    Sep 26, 2017
    Posts:
    5
    That's more just how I typed it; the semicolon is still there in the script.
     
  4. Huntertyavatar1

    Huntertyavatar1

    Joined:
    Sep 26, 2017
    Posts:
    5
    could not find system.PNG

    Here is the whole thing.
     
  5. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
  6. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    What IDE are you using?
     
  7. Huntertyavatar1

    Huntertyavatar1

    Joined:
    Sep 26, 2017
    Posts:
    5
    This should answer both of your questions. The error appears on all of the words with orange on them in the last image.

    Like I said, the script still works just fine, and will execute correctly. I just need the reason as to why it's showing up.
     

    Attached Files:

  8. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    Yeah, I'll be honest, I don't know the solution. My coworker on a mac is using monodevelop and sometimes this happens to him, but if he switches to VS for mac, it is fine. I think recently he had a similar issue and he just upgraded the project to a newer Unity version.

    Currently, on PC, I use Visual Studios and haven't encountered this issue. Since it worked when upgrading to a newer version of Unity, it may be something isn't installed correctly on your system. It doesn't hurt your project, but does make auto complete not working.
     
  9. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    Yeah I personally haven't experienced it myself as I'm also using Visual Studio on a PC, but I have worked with colleagues who worked on Macs using MonoDevelop. They'd complain endlessly about Unity crashing while debugging, etc. It seems like if they cleared out all auto-generated files, then things are OK again... at least for a while.

    Auto-generated files being project files, perhaps the library folder, etc.
     
  10. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    A couple of thoughts:
    1) is your script name and the class name the same?
    2) if you have the little 'run' icon "on" (like, you click that to compile/save), sometimes/(always?) it messes up the auto-complete - just stop that "run" and maybe close and re-open the IDE.
     
  11. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    Also worth mentioning that your filename has spaces in it which means (if Unity created it) so does your class name, which is a no-no.
     
  12. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Ditch MonoDevelop and use Visual Studio, VS Code or Rider.
     
    Suddoha and KelsoMRK like this.
  13. JoshuaMcKenzie

    JoshuaMcKenzie

    Joined:
    Jun 20, 2015
    Posts:
    916
    This looks more like the IDE has simply failed to load the Assemblies in the solution. you can either tell the IDE to reload the assemblies or delete the solution and have Unity regenerate a new solution for you.
     
    Suddoha likes this.
  14. Huntertyavatar1

    Huntertyavatar1

    Joined:
    Sep 26, 2017
    Posts:
    5
    Thanks for the responses, ya'll. At least now I know it's just MD F***ing up rather than me doing something stupid.

    I would switch to VS, but the lessons that we do apparently require MD instead, so I don't think I can get it.
     
  15. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    Yeah, I was curious if your school would even let you switch. Honestly, if they have it available, it shouldn't matter what IDE you use, unless they are teaching you MD menus or shortcuts. But if it's not even installed at school, they may not let you install it anyways.