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

squiggly red lines in VS2017

Discussion in 'Scripting' started by wendymorrison, Jan 24, 2019.

  1. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    Hi, I have just noticed that I get squiggly red lines even if I just create a plain C# script.
    squigglylines.JPG


    I have no idea what's happening. It's also the latest version of unity.
     
  2. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    It should show you a hint if you'll point your cursor on the underlined symbol.
     
  3. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    Yeah, but it never did this in earlier unity versions. Red squiggly lines usually mean there are errors in the script but as people that know how to script can see it is just a start script that has nothing I have added in it. All I did was right click and create C# script and gave it a name. Mind you I don't code but I do know that this script doesn't have any errors in it.
     
  4. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    I tried an earlier version of unity which is 2017 4.8 and there are no squiggly red lines. Although this version of unity I have never had a problem with but later ones I have.
     
  5. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    So what the hint says? It might be just code style warning or something like this.
     
  6. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    It just says predefined 'System.Void' is not defined or imported. I have no idea what it means.
     
  7. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    I have worked out this only happens to 2018 3.0f2 and 2018 3.1f1. No earlier versions of unity do this.
     
  8. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    @wendymorrison It means you are missing the .NET SDK or target framework. Depending on your setup and used libraries download and install the versions from here (.NET core sdk+framework). Also close VS while installing and reopen once done.
    https://dotnet.microsoft.com/download/visual-studio-sdks

    One of .NET core 2.0, 4.7.0, 4.7.1 or 4.7.2 is likely missing. Update VS to get the framework as it is included in newer versions (as listed)
     
  9. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    I have VS2017. So is there a newer one than that because it came with Unity 2018.3 and onwards.
     
  10. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    It does not necessarily mean the framework is not installed, it may also happen when the project file is either corrupted, or in some cases, when an exported project has not yet been built.

    The former can often be fixed by forcing Unity to re-create the solution and the linked projects. Deploying the project can help sometimes, too.

    I encountered the latter multiple times in 2017.X when I exported an UWP project to a completely new location. In this specific case, it's usually enough to build (or just deploy for the first time, which includes the build process) that project and everything will be refreshed + set up properly.
     
    MNNoxMortem likes this.
  11. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    No, I got all the new ones but it still did the same thing.
     
  12. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    Sorry didn't get what you meant. It is a brand new project and I haven't moved the project elsewhere. It hasn't happened in unity 2017 but only in unity 2018.
     
  13. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    Try the following:
    - Close the project.
    - Delete the .csproj file, the .sln file and the library folder (all of them in the project's folder).
    - Re-open Unity

    Unity should then create the library folder upon opening. At the very last, open a script file.

    If the errors aren't gone after that, then it's probably indeed missing some installation, or if you're sure the SDKs / Frameworks (the ones that were mentioned earlier) are installed, it cannot find them for some reason.
     
    Glokie likes this.
  14. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    @wendymorrison delete the library, csproj files, sln file and the obj folder. Then open it in unity.
     
  15. wendymorrison

    wendymorrison

    Joined:
    Jan 6, 2014
    Posts:
    246
    All I had to do is find the installer and update it. I had trouble finding the installer so I found a video

    that had the installer with it but also realized it was on my computer all along. So now it works via updating visual studio.
     
  16. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    I have the same problem, red squiggly lines all over the place all of a sudden. Also the intellisense feature where it shows member functions, function parameters, auto completion, and all that dont work anymore.
     
  17. wingedimagination

    wingedimagination

    Joined:
    Nov 28, 2017
    Posts:
    1
    Hi,
    I had the same problem in unity 2019.1.7 on Mac - I solved it by changing api compatibility level from .NET standard 2.0 (which was set by default after installation) to .NET 4.x.

    You can find this option in:
    Edit> Project settings> Player
     
  18. Regenfrithu

    Regenfrithu

    Joined:
    Jan 21, 2014
    Posts:
    1
    I had the same issue as wingedimagination with 2019.1.8 on Windows and it was solved by using the same method.

     
    bmsh likes this.
  19. Pharaoh35

    Pharaoh35

    Joined:
    Dec 25, 2012
    Posts:
    57
    The best solution of this problem was to completely delete unity and visual studio from my mac computer and reinstall the version you need. Don't forget to make copy of your project!
     
  20. bmsh

    bmsh

    Joined:
    Jan 1, 2018
    Posts:
    2
    This has been bugging me for over a month; this fixed the problem (in Windows) right away.
     
  21. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    From Mac > Unity 2019.3.0f3 > removed Visual Studio Community 7.7.3 > installed last revision 8.3.11.
    Works a charm.
     
  22. Deleted User

    Deleted User

    Guest

    Thank you! Sorted my issue too.
     
  23. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    This worked great for me too!
     
  24. DavidSalagean147

    DavidSalagean147

    Joined:
    Mar 11, 2020
    Posts:
    3
  25. tataygames

    tataygames

    Joined:
    Aug 4, 2016
    Posts:
    55
    WTH kind of suggestion is this
     
  26. Vincentevil

    Vincentevil

    Joined:
    Jun 6, 2018
    Posts:
    1
    This solved the whole "red squiggly lines" problem for me, thank you! (working in version 2019.3.10f1)
     
  27. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,517