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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Feature `xxx' cannot be used because it is not part of the C# 4.0 language specification

Discussion in 'Editor & General Support' started by Nodupe, Oct 27, 2018.

  1. Nodupe

    Nodupe

    Joined:
    Jan 26, 2018
    Posts:
    12
    I'm importing the window GUI to my project but i'm getting error

    Assets/IgniteModule/GUI/Elements/IgniteFoldout.cs(25,47): error CS1644: Feature `expression bodied members' cannot be used because it is not part of the C# 4.0 language specification



    I already changed language to 6 in Visual Studio but still same problem

    How can i fix it?
     
    rtbrweiterhr and KiritoKunKun like this.
  2. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    702
    same problem here:

    I think I accidentally downgraded Visual Studio when prompted by an asset from the asset store.
    It gave some warning about using a different version of c#, and that I could always revert back, so I said "OK"

    But now lots of things are going kind of haywire.

    Pretty sure I need to make Visual Studio compile in c# 6 again, just not sure how.
     
    KiritoKunKun likes this.
  3. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    702
    EDIT May 2, 2019:
    Lots of people liked this post.
    Visual Studio 2019 is out now.
    Follow along with this video (except instead of 2017, use VS 2019)

    That made me golden. (Unity 2019.1)



    OLDER POST:
    Here is what worked for me:

    go to about 4:00.

    (in case the video is gone, for you frustrated future travelers, landing on this thread: currently (2018.3), you go to edit - project settings - player - other settings. Scroll down to configuration, and change scripting runtime version to .net 4.x (or newest), and API compatibility level to .Net 4.x. Unity will restart, and then scripts using newer nomenclature should work. (ie c# 6.0)

    Also, when you open your script again in visual studio, you will be prompted multiple times that 4.x is not installed. Just choose the first option and hit ok or apply or whatever as many times as you have to.
     
    Last edited: May 31, 2019
  4. Madgvox

    Madgvox

    Joined:
    Apr 13, 2014
    Posts:
    1,315
    Make sure the Unity project is also set to .NET 4.5.
     
  5. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    702

    Don't listen to me. Now it seems VS 2017 and Unity are not quite communicating. VS 2017 intellisense does not recognize simple classes like monobehaviour (was teal, now is white like everything else). It also does not seem to be highlighting errors like it used to.

    I cant remember where it all went wrong, I think it had something to do with installing an app that was using the old prefab system (2018.3 introduced a new prefab system).

    Just another unexpected muddy road in a difficult campaign.
     
  6. argens

    argens

    Joined:
    Jun 21, 2018
    Posts:
    26

    Sorry, but was listening to you and got everything right. Thanks a lot mate! :)
     
    TimeWalk-org likes this.
  7. TimeWalk-org

    TimeWalk-org

    Joined:
    Nov 3, 2014
    Posts:
    38
    Thank you for posting this! It solved my problem perfectly.

    (in case the video is gone, for you frustrated future travelers, landing on this thread: currently (2018.3), you go to edit - project settings - player - other settings. Scroll down to configuration, and change scripting runtime version to .net 4.x (or newest), and API compatibility level to .Net 4.x. Unity will restart, and then scripts using newer nomenclature should work. (ie c# 6.0)

    Also, when you open your script again in visual studio, you will be prompted multiple times that 4.x is not installed. Just choose the first option and hit ok or apply or whatever as many times as you have to.​
     
    CAHZI, Dr-Hazrd and Sungold like this.
  8. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    tnx for this, solved my issues also
     
  9. clamum

    clamum

    Joined:
    May 14, 2017
    Posts:
    61
    Thanks for the replies! I was getting some 60-odd errors for this "cannot be used because it is part of the C# 4.0 language specification" reason, after I backed up my project (zipped up the folder) and reimported it on my Surface Pro where I had just reinstalled Windows.

    I went into the Project Settings -> Player -> Other and then changed "Scripting Runtime Version" from "3.5" (which it said was deprecated) to ".NET 4.x Equivalent" and changed "Api Compatibility Level" from ".NET Standard 2.0" to ".NET 4.x" and restarted Unity.

    After that project compiled without error and I was able to build/play it. Thanks again!
     
    klerta likes this.
  10. klerta

    klerta

    Joined:
    Apr 15, 2018
    Posts:
    10
    thanks bruh
     
  11. nisDev60

    nisDev60

    Joined:
    Jul 1, 2018
    Posts:
    1
    Thanks G