Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

C# Version

Discussion in 'Scripting' started by gcast1995, Apr 2, 2020.

  1. gcast1995

    gcast1995

    Joined:
    Oct 27, 2019
    Posts:
    25
    Hi All,

    I'm just trying to find out what version of C# I'm using in Visual Studio.

    I've done some research on the internet and found that Project Settings is where the version is located, however, when clicked, it appears to open and quickly close. With some further research I found that you need to go to 'Tools>Options>Tools for Unity>Miscellaneous>Access to project properties' and set it equal to 'True'.

    So I did this and restarted Visual Studio, but it still doesn't work. It only opens and displays and error page. Specifically it says:

    "
    An error occurred trying to load the page.
    Could not load file or assembly 'Microsoft.VSDesigner, Version=15.0.0.0, Culture=neutral, PublicKeyToken=********' or one of its dependencies. The system cannot find the file specified.
    "

    Can anyone provide some insight on this? Thanks!
     
    Last edited: Apr 5, 2020
  2. gcast1995

    gcast1995

    Joined:
    Oct 27, 2019
    Posts:
    25
    Bump, really looking for this.
     
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,124
    Unity supplies its own compilers for C#. Visual Studio is only used as a code editor, and for C++ compiling when you create IL2CPP binaries.

    https://docs.unity3d.com/Manual/CSharpCompiler.html
     
    onopko123 likes this.
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,771
    All versions of Unity currently use C# 7.3. That is not something you can modify with an editor setting.

    The error seems to indicate that this project is using a .NET assembly named Microsoft.VSDesigner.dll. Do you know what version of .NET that assembly is compiled against? For example, is it built against .NET Framework 4.7.1, .Net Standard 2.0, or .NET Core 3.1, etc.?
     
    RKeown3D, gjf and Ardenian like this.
  5. KoalaJoe

    KoalaJoe

    Joined:
    Mar 23, 2020
    Posts:
    2
    I did a Google search, it took me 7 seconds to find this. Not making fun of you, but I am stressing the fact, that if you wish to develop/code, you will need to get good at Googling. You Cannot be lazy on this, else you will find your self lost, a lot more often than not.

    https://www.geeksforgeeks.org/c-sharp-version-history/


    I'm also working on this, I recommend you do so too, if you have not already. Don't skim or skip. You (we,) can always learn a new trick we missed the 1st time around.

    https://learn.unity.com/?_ga=2.167223229.2098605857.1572889442-1027418588.1572889442


    Btw. the version of VS studio that you use, should be the one recommended by unity for the unity version you are using, else you will suffer from errors all the time, like the one/s you are having. If you are not to familiar with coding in C#, go to COURSERA and do a search for FREE C# courses there. Make sure you pick a course that is not older than one version at most of the version your unity version uses. --> Play with the search option: C# or C Sharp or unity coding or unity or unity C# or --> You get the picture.

    https://www.coursera.org/search?que...oducts_term_optimization&allLanguages=English

    All of this, has to be done, because with each update of unity, they update their compiler to run with a specific version of C# too. Drag and drop visual coding is fine for small stuff, but for an actual game that is requiring manual coding, due to it's size, you NEED to learn how to code. No need to be a master, but you do need to be close to intermediate level.
    The same applies to the assets you are using. Different software, use different versions of C# compilers. So when you import them into unity, they might not always work. The Asset sellers, will usually post what version of unity it is good for. The older the assets get, the cheaper they become in many cases due to this compatibility issue. But if you know how to code, you can fix the issue yourself, and you get to save money in the process! ;-)

    Look at the top left, where it shows the version of unity the manual is for, you can change it, and in the scripting section, it will tell you which version of C#, the current version of unity you are looking at uses.

    https://docs.unity3d.com/2019.4/Documentation/Manual/CSharpCompiler.html


    I'm about to sign up for this course myself, in order for me to 'Stop' procrastinating and actually learn how to code in C#. I have Python coding experience, but I do not want to take forever learning C# on my own, experience has taught me that. If I pay for it, I will learn, plus I will have the class cohort for referencing, collaborating and pair programming. Pair programming is the most valuable tool for learning.. for me.

    https://circuitstream.com/c-scripting-fundamentals-in-unity/

    I know I wrote you a novel, I hope it helps you on your way to becoming a good unity developer!
     
    Last edited: Jan 19, 2022
  6. cmersereau

    cmersereau

    Joined:
    Nov 6, 2020
    Posts:
    52
    This was all you needed to say. Your other links are not relevant to the question being asked.
     
  7. Mistyre

    Mistyre

    Joined:
    Jul 3, 2023
    Posts:
    1
    but i have c# 6 and i need c# 7 but i cant update it when im in unity 2018.2.14f
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,771
    You will need to use a newer version of Unity to get C# 7 support. We don't release 2018 updates of Unity any more, so we won't be adding support there.