2

I've updated the player settings API to be 4.6 as documented. But my project is still targeting 3.5.

I also tried to manually update the csproj to 4.6 But after unity was opened it overrided it again to 3.5.

Notice that I've update the Visual Studio Tools For Unity to the latest version (3.1.0.0)

Anything I'm missing? Is this a known bug? If so, is there a workaround?

Tomer Peled
  • 3,571
  • 5
  • 35
  • 57

1 Answers1

2

You have to enable this from the Editor itself. By the way, you can now download the latest version which is no longer in beta mode.

Go to Edit --> Project Settings --> Player --> Other Settings --> Configuration --> Scripting Runtime Version --> .NET 4.6 Equivalent

then

Go to Edit --> Project Settings --> Player --> Other Settings --> Configuration --> Api Compatibility Level --> .NET 4.6

This menu may have changed but this where it used to be and I expect it to be there or under that menu.

EDIT:

You must restart Unity Editor then restart Visual Studio to make these changes to take effect.

".NET 4.6 Equivalent" Menu has changed to "Experimental (.Net 4.6 Equivalent)".

If after restarting both Unity and Visual Studio but the version is still not changing, re-install both Unity and Visual Studio and make sure that you are running the latest version of Visual Studio.

Before re-installing visual studio - make sure you installed the latest update, if not try to update first.

Tomer Peled
  • 3,571
  • 5
  • 35
  • 57
Programmer
  • 121,791
  • 22
  • 236
  • 328
  • Sorry for misleading I'm using the latest Unity version (not the beta) – Tomer Peled Jul 14 '17 at 08:43
  • I did the same as you mention... but it doesn't work – Tomer Peled Jul 14 '17 at 08:43
  • By the way on my Unity it says under the "Scripting Runtime Version" => "Experimental (.Net 4.6 Equivalent)" – Tomer Peled Jul 14 '17 at 08:45
  • That's fine. Close visual studio. Change the settings back to default from Unity, restart Unity. Do what's in my answer then restart Unity again. Now, open Visual Studio. All you had to do was restart Unity and Visual Studio. That's what I did to get mine working. – Programmer Jul 14 '17 at 08:46
  • *"By the way on my Unity it says under the "Scripting Runtime Version" => "Experimental (.Net 4.6 Equivalent)""* That's correct. Looks like they changed it. Use that instead. – Programmer Jul 14 '17 at 08:47
  • 1
    Tried again as you suggested, no success... Unity creates the csproj with target for 3.5 even though under the editor settings I've defined it to be 4.6... – Tomer Peled Jul 14 '17 at 09:13
  • 1
    Can you create a new project and see what happens? Just test with a new project and see if the-same problem is still there. – Programmer Jul 14 '17 at 09:15
  • Took your good advice and checked it. But that same situation... New empty project with just one test script. Did what/how you recommended to operate but still the csproj is targeted to .Net 3.5 – Tomer Peled Jul 14 '17 at 12:20
  • At this point, the only solution left before I consider this a bug is Uninstall both Unity and Visual Studio. Restart computer then install them again. You can also try [Unity 2017.2.0b2](https://unity3d.com/unity/beta) which is a new beta if this does not work. – Programmer Jul 14 '17 at 12:25
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/149228/discussion-between-tomer-peled-and-programmer). – Tomer Peled Jul 14 '17 at 12:51