Search Unity

Unity - says you're using C# version 4 and how to fix it

Discussion in 'Editor & General Support' started by DarthHawk13, Aug 16, 2019.

  1. DarthHawk13

    DarthHawk13

    Joined:
    Feb 24, 2016
    Posts:
    63
    I had this problem. I was programming a project in Unity 2018 and everything went along fine. Then I loaded an old project from an older version of Unity and imported it into Unity 2018. After adding code and trying to compile it Unity told me what I was doing was not valid in C# version 4.... What the fuzz? :(Who's using C# version 4! I'm certainly not this is Unity 2018! :mad:

    I believe for me the problem was the fact I had imported a project with a older version of .net into Unity 2018. However the fix may work no matter why you are getting informed by Unity you're using an older version of C#.

    FIX:
    In the build settings > player settings >
    Go to Configuration... see picture below... and change the version of .net your project is using ;)

    The red arrow is meant to be pointing at "Scripting Runtime Version" and "Api Compatibility Level" Those are the two settings that may need to be changed if you have the problem of Unity telling you your code won't work in C# version 4 and you need to upgrade.
    PlayerSettings.jpg
     
    WhendricSo likes this.
  2. WhendricSo

    WhendricSo

    Joined:
    Jan 1, 2011
    Posts:
    171
    Wow thanks for posting the solution, too!