Search Unity

Note to other Visual Studio users upgrading to Unity 5.2

Discussion in 'Editor & General Support' started by Baste, Sep 8, 2015.

  1. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,426
    UPDATE: Since people keep posting here to bring the post back up to the top:
    the problems in the original post were all gone for me some time during 2016.

    This might've been a fluke, but in case it's consistent, I'll post this:

    Upgrading to Unity 5.2 broke VS Tools for Unity for me - VS tools was unselectable in the External Script Editor drop-down, and opening any script caused MonoDevelop to open and promptly fail to load anything if "normal" visual studio was selected.

    All of this was fixed by simply deleting the VS tools folder from the Assets folder of the project. It seems like having both the new built-in VS tools and the old .dll causes both of them to fail hard.

    Big props to the dev team for adding VS tools as a standard feature in Unity.

    EDIT: As you can see by following this thread, the UnityVS integration isn't quite there. There are some instances where integration used to work in 5.1 + UnityVS, where it doesn't work anymore. The known problems are:

    Users of the Resharper plugin cannot open scripts from Unity without first opening Visual Studio manually
    Mac users running Visual Studio on a VM doesn't have working integration

    It may seem like other plugins can also cause the integration to fail.
     
    Last edited: Jan 31, 2017
    MattStGer and Sungold like this.
  2. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    779
    Are you by any chance using 2013? I saw a separate post stating it was broken when using 2013.
     
    LieweHeksie likes this.
  3. Hodgson_SDAS

    Hodgson_SDAS

    Joined:
    Apr 30, 2015
    Posts:
    123
    Yes, I'm also using 2013 and I can't get it to load anything other than monodevelop
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,622
    yuliyF likes this.
  5. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    248
    Sadly, better integration is, in fact, broken integration.
    Back to waiting forever for Visual Studio to open, failing, and Mono Develop launching.
    Using Visual Studio 2015 Community, VSTools 2.1, and Unity 5.2.
    Rolling back to to 5.1.3f1
     
    Mophs likes this.
  6. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    148
    @FuguFirecracker Hey, sorry to hear it's giving you trouble. Any chance you could send me editor log file for when it was unable to get VS2015 Community to open?
    In the about window, (Help->About) did it in the left bottom mention VSTU tools?
     
  7. AnonnyMoose

    AnonnyMoose

    Joined:
    Nov 28, 2014
    Posts:
    24
    Lucas - which about window (Unity or Visual Studio) is meant to mention the VSTU tools?

    I have a different issue. I have 2013 installed, but it was a bit flakey with debugging. So I thought I'd install 5.2 with the VS 2015 Community Edition. Unity kept 2013 as my default, so I manually changed the external tools option to 2015 CE. That opens fine, including the Unity Scripting API reference page. But how on earth do I start debugging my app? Attaching to the Unity process doesn't work.....
     
  8. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    206
    Up until 5.1.3 double clicking a file (or error message in a file) opened the file in Visual Studio 2015
    Now in 5.2 it insist on starting a new Visual Studio instance which takes 20+ seconds
     
    aj-highline and Hodgson_SDAS like this.
  9. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    148
    @AnonnyMoose inside Unity, in the Help->About window, in the left bottom, it should say something like "Visual Studio Tools for Unity loaded with a version number". If it doesn't say that, then the problem is that for some reason Unity didn't open the VSTU "plugin" that is now installed with VSTU instead of imported in your project.

    @Hyp-X: Are you saying that if you click three different files, Unity will try to open 3 different VisualStudio's for you? Could you let me know what your about window (help->about in unity) says in the left bottom?
     
  10. ashwinFEC

    ashwinFEC

    Joined:
    May 19, 2013
    Posts:
    34
    I'm running Unity on a Mac and Visual Studio 2015 trough VMware. Before 5.2 I was able to use this setup perfectly with the VSTU unitypackage, but now with 5.2 I am having trouble to get Unity to see if VSTU is installed so it doesn't generate the correct project files. I've added Visual Studio as a External Editor trough the browse function. Double clicking a file will open the file in Visual Studio but it won't load the project. Using "Open C# Project" opens MonoDevelop and Visual Studio but it can't resolve anything from the Unity API.

    I've reinstalled Visual Studio 2015 community and VSTU 2.1 but it still doesn't work.

    Edit: I've noticed that the Visual Studio app I can add trough the "Browse..." function is an app generated by VMware and acts as an shortcut. So I tried to add the EXE directly by sharing the Visual Studio folder but I can't, as expected, add the EXE. I think there should be an option for Mac users to force generate the correct project files that work nicely with VSTU.
     
    Last edited: Sep 9, 2015
  11. Maxi77

    Maxi77

    Joined:
    Mar 3, 2015
    Posts:
    15
    I got a related problem... I installed Unity 5.2 (and selected Visual Studio 2015 Community for installation aswell), but the aboutbox in unity does not show the VSTU line.

    I can see that VSTU is installed and I have selected VS 2015 as editor in Unity.
     
  12. AnonnyMoose

    AnonnyMoose

    Joined:
    Nov 28, 2014
    Posts:
    24
    I'm the same as Maxi77. No VSTU in the about box, but it does have the option "Assets->Open C# Project" which opens Visual Studio. I just can't debug at all.
     
  13. jbevain

    jbevain

    Microsoft

    Joined:
    Feb 22, 2012
    Posts:
    136
    Hi all,

    Jb from the VSTU team here.

    For folks with troubles setting up VSTU 2.1 and Unity 5.2, we had a pretty simple doc for you, make sure you go through the checklist at the end:

    http://unityvs.com/documentation/native-support/

    For folks with Unity on OSX and VS in a VM, that's not a scenario we officially support so it may or may not work currently. Unity on OSX still requires the VSTU package to be imported to generate the projects files to be opened in VS in a VM. We never supported opening scripts in VS accross a VM I'm afraid.
     
  14. Maxi77

    Maxi77

    Joined:
    Mar 3, 2015
    Posts:
    15
    Checklist
    Let's go over the steps one more time:

    • Install Visual Studio and the Visual Studio Tools for Unity. Check
    • In Unity, delete the UnityVS folder if you were previously working with VSTU in an older Unity. Did not use VSTU before.
    • In Unity, set Visual Studio to be the external script editor. Check
    • In Unity, check that the native VSTU support is enabled in the About Unity window. Nope???
    Clicking on a script in unity does open VS.
    I do have the option to debug unity project in VS.
    I do have the unity reference manual link in VS help menu.
    It looks like im missing the rest of the integration features.
     
  15. ashwinFEC

    ashwinFEC

    Joined:
    May 19, 2013
    Posts:
    34
    But that's the problem. Unity 5.2 ignores the VSTU package so it's impossible for Mac users to even generate the project files.
     
  16. jbevain

    jbevain

    Microsoft

    Joined:
    Feb 22, 2012
    Posts:
    136
    That should be a Windows only behavior, so it hints at a Unity bug. I'll follow up with the Unity team, thanks for reporting this!
     
  17. AnonnyMoose

    AnonnyMoose

    Joined:
    Nov 28, 2014
    Posts:
    24
    Ok, re-installed the VSTU package again and now I have debugging apparently working, thanks guys.

    Still not mentioned in the Unity->About window though!
     
  18. jbevain

    jbevain

    Microsoft

    Joined:
    Feb 22, 2012
    Posts:
    136
    All right, let's investigate a bit further:
    • I assume you have installed the latest VSTU which is 2.1.
    • I assume you have installed VSTU for the same version as your Visual Studio. (VSTU 2015 for VS 2015 for instance). Let's assume you're on 2015.
    • VSTU should have installed the file SyntaxTree.VisualStudio.Unity.Bridge.dll in the folder: C:\Program Files (x86)\Microsoft Visual Studio Tools for Unity\2015\Editor
    • VSTU should have written the registry key `HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft Visual Studio 2015 Tools for Unity` with a value being the full path to the dll just mentionned.
    • In the external tools in Unity, I assume you selected the proper Visual Studio version, say 2015.
    The registry key is basically what Unity uses to find and load VSTU for the selected VS version.
     
  19. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,426
    And the bug is back. I thought I had it working yesterday, but a restard brought it back.

    @jbevain, all of those are the case for me. Unity 5.2's still opening MonoDevelop. I uninstalled Unity, and deleted the Vs tools folder. Then I reinstalled Unity and included the VS tools in the install. Whenever I open a script, it shows me the good old "Starting up Visual Studio, this might take a few seconds", before opening MonoDevelop.

    The Vs tools menu option that used to exist is gone now. Is the need to manually generate the VS tools project files gone? Might this be happening because I still have them in my project?

    I know that when Unity fails to open a script in the external editor set in preferences, it falls back to MonoDevelop. Is there anywhere I can check to see what's going wrong when it tried to open VS?
     
  20. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    206
    Ok, problem solved it was a confusion between the old and new name of the solution file.
    Even though I deleted the old solution and project files (UnityVS* named), I was somehow able to open it from VS2015 recents.
    (It only opened one more VS because the open solution was different.)
     
  21. Maxi77

    Maxi77

    Joined:
    Mar 3, 2015
    Posts:
    15

    • I assume you have installed the latest VSTU which is 2.1. Yes, I only have the version that came with the unity installer.
    • I assume you have installed VSTU for the same version as your Visual Studio. (VSTU 2015 for VS 2015 for instance). Let's assume you're on 2015. Yes, Visual studio 2015 Community (came with the installer)
    • VSTU should have installed the file SyntaxTree.VisualStudio.Unity.Bridge.dll in the folder: C:\Program Files (x86)\Microsoft Visual Studio Tools for Unity\2015\Editor Yes, it is there in that exact folder.
    • VSTU should have written the registry key `HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft Visual Studio 2015 Tools for Unity` with a value being the full path to the dll just mentionned. Yes in a subkey called UnityExtensionPah, points to the exact position above.
    • In the external tools in Unity, I assume you selected the proper Visual Studio version, say 2015. Yes

    Still no VSTU line in aboutbox
     
  22. Hodgson_SDAS

    Hodgson_SDAS

    Joined:
    Apr 30, 2015
    Posts:
    123
    I am using the latest version and still only getting Monodevelop.
    I've followed the steps from the VTSU link, even uninstalled everything and re installed.

    Still no dice. Works for VS 2015 Community but not VS 2013 Professional.
    My company is too large to legally use VS 2015 Community.
     
    Last edited: Sep 9, 2015
  23. jbevain

    jbevain

    Microsoft

    Joined:
    Feb 22, 2012
    Posts:
    136
    Can you try to open Visual Studio outside of Unity?
    Also can you try to open the solution generated by VSTU (in the root folder of your Unity project) in Visual Studio, but with a VS opened outside of Unity?

    Maybe VS is trying to prompt something, and as it's not responding, Unity fallsback to MonoDevelop.
     
  24. jbevain

    jbevain

    Microsoft

    Joined:
    Feb 22, 2012
    Posts:
    136
    Everything looks good on the VS/VSTU end of things. I suggest you open a bug with Unity.
     
  25. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,426
    Just did that: Opening the project directly from VS works. Attaching to Unity and running the debugger also works.

    Even if the project is open outside of Unity, double-clicking a script still causes MD to open. There's also no VSTU solution generated; I've only got these project files:

    Game_Name.CSharp.csproj
    Game_Name.CSharp.Editor.csproj
    Game_Name.CSharp.Editor.Plugins.csproj
    Game_Name.CSharp.Plugins.csproj
    Game_Name.sln

    Almost revealed the name of our game there half a year too ealy. Whoops.
     
  26. jbevain

    jbevain

    Microsoft

    Joined:
    Feb 22, 2012
    Posts:
    136
    By the look of them, those are generated by VSTU (with the native support we no longer write project files with the UnityVS prefix). It means Unity properly picks up VSTU and has native support enabled for it.

    It seems your setup somehow triggers a condition where Unity fails to open Visual Studio. I suggest you open a bug with Unity.
     
  27. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,426
    In the meantime, is there any way to disable native support and use the old plugin version? So I can do anything at work before Unity fixes the bug in 5.3?
     
    bluescrn and Hodgson_SDAS like this.
  28. jbevain

    jbevain

    Microsoft

    Joined:
    Feb 22, 2012
    Posts:
    136
    Could you look into your Unity's Editor.log, it should give you a reason why it failed to open VS and went back to use MonoDevelop. Thanks!
     
  29. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,426
     
  30. jbevain

    jbevain

    Microsoft

    Joined:
    Feb 22, 2012
    Posts:
    136
    Nice, a good old 0x80010001 (RPC_E_CALL_REJECTED). Thanks!
     
  31. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    248
    was unable to get VS2015 Community to open?
    In the about window, (Help->About) did it in the left bottom mention VSTU tools?[/QUOTE]

    Sorry, I already reverted back to 5.1.3

    And yes, it DID mention the VSTU tools in the 'About' box.


    I had the sense enough to peep the docs before anything was updated. Was certain I followed the instructions outlined on linked page to the letter... All 3 times I tried to get it working.

    I had VSCommunity 2015 and VSTools 2.0 working just swimmingly. Something is wonky with the update, and I'm sorry to say I don't have the time to devote to hunting down the culprit.
     
  32. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    248
    Ah yes... I should have made mention that I have ReSharper installed as well.
    Removing ReSharper is not an option.
     
  33. Cixelyn

    Cixelyn

    Joined:
    Jun 27, 2014
    Posts:
    1
    I'm also having the issue where monodevelop opens instead of visual studio:
    Seems to be somewhat sporadic though -- if I restart Unity enough times and delete the csproj files, it'll eventually let me use Visual Studio.
     
  34. Hodgson_SDAS

    Hodgson_SDAS

    Joined:
    Apr 30, 2015
    Posts:
    123
    Ahh yes, I am also using Resharper
     
  35. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,426
    Same here!
     
  36. xenonsin

    xenonsin

    Joined:
    Dec 12, 2013
    Posts:
    20
    Hi Jb,

    Upgrading Unity to 5.2 has been very strange for me. I have gone over your checklist and can open c# files in vs2015 just fine, but I still have problems.

    1. Assets -> Open C# Project just opens the project folder in the explorer NOT in vs2015.
    2. I am unable to attach visual studio to Unity.
     
  37. sxa

    sxa

    Joined:
    Aug 8, 2014
    Posts:
    242
    Seeing the same thing. Uninstalling ReSharper 'fixed' it. Not exactly a 'solution' though.
     
  38. Dave-Carlile

    Dave-Carlile

    Joined:
    Sep 16, 2012
    Posts:
    961
    I was having this issue as well and was able to fix it.

    This is more or less the path I took...

    - Installed Unity 5.2 including VS 2015 Community and VS Tools for Unity. Everything seemed good.
    - Opened up project, double clicking C# file would open in VS 2015, but could not attach to Unity for debugging, VS Tools functionality wasn't available at all.
    - I noticed I still had the VS Tools folder in my project so I deleted that, restarted Unity, same thing.
    - Came here to research - noticed that my Help/About didn't show that VS Tools was installed. Went through the checklist several times, nothing changed.
    - Finally went to the VS Tools website and manually downloaded the VS Tools install for 2015.
    - Quit Unity, ran the install, started Unity back up, looked at Help/About and saw VS Tools was available.
    - Went through and exercised the VS Tools functionality and everything is working.

    tl;dr: Remove the old VS Tools folder from your project. Quit Unity. Manually install VS Tools for VS 2015. Restart Unity. Hopefully you're good to go.
     
    JoeJoe likes this.
  39. bigbadtrumpet125

    bigbadtrumpet125

    Joined:
    Apr 1, 2013
    Posts:
    18
    Exact same steps i took and it worked for me as well. I also had to restart my computer because some background VS program was running that I couldnt seem to kill which caused the install to fail. But after restarting my computer and installing the unity tools from the MS site it worked
     
  40. xenonsin

    xenonsin

    Joined:
    Dec 12, 2013
    Posts:
    20
    Got it to work. Had to delete all the .sln and .csproj files then from Unity ... Assets -> Open C# Project.

    Opened successfully in vs2015 and was able to attach to unity and use all VSTU features.
     
  41. afftar

    afftar

    Joined:
    Apr 18, 2014
    Posts:
    50
    I have Visual Studio 2013 PRO and all of my (not unity) projects using it.+ They are using third-party libraries compiled on VS2013. Migrate to 2015 Community - impossible!! It is outrageous to offer this!!!
    I cant add and use any my DLL project in Unity VS solution and debuging it (( New intergation - S***.
    In general, the whole horrible 5.2(i have new problems with particles,ui)
    I go back to the old version
     
  42. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    934
    This may not be the full-blown Visual Studio, but VS Code works fine for me.
     
  43. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    493
    Was using VS2010 Pro. Had been working great with earlier versions. Not anymore, even after removing the old UnityVS files and updating the VS plugin

    Not really prepared to downgrade to a newer version - generally happy with VS2010 + Visual Assist.
     
    Last edited: Sep 13, 2015
  44. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    219
    I have the same problem as many here, vs2013 does "not" start from unity, but:
    • monodevelop does not start
    • visual studio actually does start, i see it running when I use the process explorer, but it is not visible, nor does it ever become visible
    • I am using resharper
    This must be something to do with resharper.
     
  45. RedMist

    RedMist

    Joined:
    Jul 31, 2014
    Posts:
    1
    Yep, all completely broken for me. I've read all the steps and checklists and been through it to the letter 3 or 4 times and it makes no difference. I downloaded Unity 5.2 about 2 hours ago, and VS2015 Pro and the Unity VS Tools and installed on a fresh Windows 10 install.

    Assets > Import > Visual Studio 2015 Tools

    This gives me a UnityVS folder as expect but no Menu group, and nothing to select from the Preferences > Ext Tools section, only Mono available. VS2015 has run once and is installed fine.

    Please advise.
     
  46. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    319
    I can debug our game with VS2013 and Unity Editor 5.2 64-bit for Windows. I posted my steps
     
  47. davecazz

    davecazz

    Joined:
    Dec 27, 2013
    Posts:
    31
    any word on getting 5.2 and vstu to work on the osx? Really need to get 5.2 working on my current project and not having vs15 will severely hamper me.

    Like the above posters, I do not see the old visual studio tools menu item. the local UnityVS package is getting filtered out even though it's being run on a mac.
     
  48. Ellandar

    Ellandar

    Joined:
    Jan 5, 2013
    Posts:
    207
    If this helps anyone.
    I'm using Unity 5.2
    Visual Studio 2015 community
    Resharper 9.2

    I've found that visual studio will open, and then close a couple of seconds later.
    Sometimes it won't open at all, and monodevelop will open instead (if installed).

    My work around is this:
    Open Visual Studio separately and disable resharper (Tools -> Options -> Resharper Ultimate -> Suspend Now).
    Close Visual Studio.
    Go to Unity project and double click on one of your scripts.
    Visual Studio will now open.
    Re-enable resharper.

    Double clicking on your scripts will now work. If you close visual studio then you will need to repeat the above steps.
    This only works if VS is setup correctly, use these steps from this post if you are unsure: Steps to check VS and Unity

    I logged this problem if you wish to track it: https://fogbugz.unity3d.com/default.asp?727188_5604jjr7vdpvas1u
     
  49. holyjewsus

    holyjewsus

    Joined:
    Mar 7, 2011
    Posts:
    624
    mac -> vm support seems to be messed up currently.

    1) I've imported the package manually but it seems that unity ignores it so there is no menu for regenerating the project files.
     
  50. Tristan.fgol

    Tristan.fgol

    Joined:
    Sep 3, 2014
    Posts:
    12
    Just want to add my support for getting this working on Mac again! We rely on UnityVS a bit for working in Mac with a Windows VM