Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Visual Studio Tools for Unity

Discussion in '5.2 Beta' started by topofsteel, Jul 14, 2015.

  1. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    How do I install VS tools in the beta? Is it looking for the default installation path? Thanks.

    Edit: It wasn't available from the Assets menu, but coping the folder from another project worked fine.
     
    Last edited: Jul 15, 2015
  2. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    The Unity betas don't use the standard install path. Thus, the VS Tools installer is not able to find the Unity installation and copy the unity package to the appropriate folder.

    Here's how to manually add VS Tools for Unity to a Unity Beta installation.**

    When you install VS Tools for Unity, a copy of the unity package is placed in:

    "C:\Program Files (x86)\Microsoft Visual Studio Tools for Unity\2013\"*

    Copy the "Visual Studio 2013 Tools.unitypackage" file to the "Editor\Standard Assets" folder of your Unity install path.

    So if you installed Unity 5.2.0b2 the full path would be:

    C:\Program Files\Unity 5.2.0b2\Editor\Standard Assets\​

    *This assumes you are using VS 2013 with 64 bit Windows. The path will be slightly different on 32 bit Windows or different versions of VS.

    **If you are not using a Unity beta nor have Unity installed to a non-stanard path, the VS Tool installer will work without having to manually copy the unity package file.
     
    Last edited: Jul 15, 2015
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    For first timers, they should follow the recommended path first:

    Simply go and download VS CE 13 or if you use a paid version, that's cool too. Not express.
    Then from MS download the corresponding plugin. Install the plugin by running the installer.
    Then in Unity merely import the package (it will find it automatically).

    That's it. Instructions on ms' site.

    If your install path is strange then read above post. I am only posting this for people who stumble across it with curiosity and wish to try VS (well worth it I assure you).
     
  4. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    @hippocoder I know! I had been using VS Express 2012 for c# development writing plug-ins for another application, and occasionally for Unity. I decided to see if integrating VS Express into Unity was any easier than it used to be. Discovered VS CE 2013 and VS tools for Unity, it was a good day!
     
    hippocoder likes this.
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yeah I used to be a big sublime text fan but unfortunately (or fortunately?) this project is simply too big for Sublime text, and has outgrown it too far. VS is required for substantial projects.
     
  6. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    I agree with you. I only posted this info to the beta forum.

    The Unity betas don't use the standard Unity install path.

    Thus the VS Tools for Unity installer can't find the Unity installation and doesn't copy the unity package to the correct folder in a Unity Beta installation.

    I was not clear about it (I will edit the post) but my instructions were for manually installing the VS Tools on a Unity beta installation.
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    My beta does work with the ms instructions however. It's probably just because the install path is C:\Program Files\Unity

    I'm not really sure why my Unity installs thus but it's probably just good to share findings regardless.
     
  8. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Did you set the path that way manually or is that what it asked for during the install?

    Every beta I've tried since the 5.0 betas has asked to use a non standard path.
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I'm on Alpha and Beta groups, it probably got stuck sometime during there (rather than public alphas), but it's all a haze now. So many alphas and betas. Probably ruined my SSD's lifespan. Anyway - everyone should try and get VS running ;)
     
  10. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    http://unity3d.com/unity/beta

    How does it work?
    Should it work with Visual Studio 2015 RC?
    How is it different from Unity 5.1 + Visual Studio 2015 Preview Tools for Unity?
     
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Oh - probs just means you no longer need to screw around with plugins. I never checked it on that. Basically the reason for this thread x 1000.
     
  12. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    527
    I just played a bit with b3. I deleted my old UnityVS asset folder, closed Unity, deleted all the csproj and sln files and then restarted Unity. In the preferences/external tools I set the editor to VS 2015. Then under Assets you find "Open C# Project". This will now create the csproj and sln files again and then launch VS2015. So far so good! Really cool!

    The only thing I cannot get to work is debugging. Attach to Unity is missing, and selecting "Debug/Attach Unity Debugger" will not show any processes. Did somebody else get debugging to work?
     
  13. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Oh, beta 3 is out? I'll have to grab that...
     
  14. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    I had the same experience. Had to bring UnityVS assets back.
     
  15. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Please report any issues with debugging as a bug / unfinished feature.
     
  16. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    Starting with Unity5.2 beta 3, Unity has improved support for UnityVS/VSTU.

    You no longer need to have the UnityVS package imported into your project.
    The "Visual Studio Tools" menu item is also no longer there. You can check if VSTU is loaded by going to the about window, and checking the bottom left. If it is loaded, it will say so there.

    Unity will only load it if you specify VisualStudio as your preferred external editor.

    This functionality requires the very latest VSTU to work. The Unity5.2b3 installer will install this for you if you ask it to install Visual Studio. You can also download VSTU from the microsoft site, but you need to make sure you download it again, as they shipped a new version two days ago, and you need that version.

    We'd love to get some feedback from people who try it. Does it work for you? Are you running into problems we didn't foresee? Is there anything obvious that we could do to make it even better?

    This required changes in how we deal with "selected script editor", how we generate c# projects (also for monodevelop). How we open VisualStudio. We'd appreciate if you can be on the lookout for any unforeseen problems there.

    Thanks! Lucas
     
    schmosef likes this.
  17. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    One more note, there is a bug in beta3 where a UnityVS that lives in the project folder can conflict with the system installed version. I'll fix this in an upcoming beta. For now, remove the one from the project folder for best results.
     
  18. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    527
    @Lucas: for me debugging did not work. I had to import the unityvs package again and that solved it and then the experience is good. I was on beta 3.

    If I could change on thing then that there is no modal dialog "Opening Visual Studio Solution" anymore that is there 3-5 seconds blocking all other interactions.
     
  19. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    Hey @10FingerArmy, if you are able to go back to the "it doesn't work" situation, I would love to know if you see "Visual Studio Tools for Unity" in the about window in the bottom left.

    When you say "debugging didn't work", what exactly didn't work? were you unable to attach? did you not have the "attach unity debugger" menu item in visualstudio?

    Thnx! Lucas
     
  20. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    @Lucas Meijer
    I'm pretty happy that UnityVS is now fully integrated into the editor. I'm having a little problem though with compiling my project with the latest UnityVS version. The code below leads to a compiler error in UnityVS, but compiles fine in the Editor:

    Code (csharp):
    1.  
    2. using System;
    3. using UnityEngine;
    4.  
    5. namespace Assets
    6. {
    7.   public class CompilerBug : MonoBehaviour
    8.   {
    9.   private Action<string> myAction;
    10.  
    11.   private void Awake()
    12.   {
    13.   myAction += MyActionHandler;
    14.   }
    15.  
    16.   private void MyActionHandler(string s, int defaultParameter = 0)
    17.   {
    18.   }
    19.   }
    20. }
    21.  

    I talked to Jb Evain from the UnityVS team and he told me that UnityVS is right in this case and that this is a bug in the Unity script compiler (accoring to the specs). I've attached the small script which causes the error.
    The workaround is not complicated, but the error is annoying, as I have to comment out the "wrong" code and only then can attach VS onto the editor.

    Should I file a bug ticket with that or are you already aware of that bug?
     

    Attached Files:

  21. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    You should submit a bug report.
     
  22. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Indeed, that does not look like valid C#, and might crash violently should you call that delegate.
     
  23. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    Okay, I'll create a bug ticket for you.

    Update: And it's up: Case 717447.
     
    Last edited: Aug 4, 2015
  24. ShuraK

    ShuraK

    Joined:
    Jan 15, 2015
    Posts:
    23
    Got the following error when I try to debug with vs 2013:
    "A project with an Output type of Class Library cannot be started directly"

    tested in unity 5.2B6

    have removed unity vs tool b4 installing unity
     
  25. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741
    The change of having VSTools for Unity Built in now is kinda nice now, but i would love a option to still do things the old way.

    Right now it seems i can only generate valid solution and projects for visual studio from the windows version of Untiy, which really sucks since for years now i have been running Unity on OSX than using it with Visual Studio 2013 pro running in a parallels Virtual Machine.
     
  26. InXile_BenMoise

    InXile_BenMoise

    Joined:
    Jan 9, 2013
    Posts:
    1
    Hi.
    Our company updated to 5.2.0f2 today, and we're unable to attach Visual studio's Debugger to Unity following the upgrade.
    Most of us are using VS community 2013. We've got one or two paid VS floating around, and I updated to community 2015 to try to resolve the issue, to no avail.

    Per the suggestions in this thread and others, I've removed the previously installed UnityVS, in favor of using the version packaged with 5.2; the "About Unity" window says i'm using UnityVS 2.0.0.0.
    I have tried deleting all the .slns and .csprojs in Main, and using "Assets > Open C# project" to regenerate them; the VS versions of these files have not reappeared, though I am able to check out and edit in VS without issue.

    In my case, when selecting "Attach To Unity," no targets appear in the pop-up window. In some others, the "Attach To Unity" button is replaced by a button that simply says "Start," and an error message pops up when attempting to use it. One of us was able to attach to Unity and debug by reinstalling the UnityVS tools from the web, but that hasn't worked for the rest of us.
    Across the board, we are able to attach to Unity and debug if we switch over to Mono in the External Tools window.

    Any info that'd help use fix our debugging would be appreciated! I've attached a couple of screenshots to help confirm what we're seeing.


    about.png externalTools.png noDebugTargets.png aboutVS.png
     
  27. Joey_Zhang

    Joey_Zhang

    Joined:
    Apr 17, 2009
    Posts:
    14
    Bump!
    Also cant find my Unity Editor in "Attach Unity Debugger" window.
    I'm using Unity5.2.0f3.
     
  28. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    I haven't played with this yet but I notice that a new version of UnityVS (I think the new version number is 2.1) was just made available and the release notes say that it's the required version for use with Unity 5.2.

    Anyone having issues with Unity 5.2 + UnityVS should make sure they are using the latest version of UnityVS and read the release notes to see how to configure the integration properly.