Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

VS Code Unity Debugger Extension Preview

Discussion in 'Scripting' started by lukaszunity, Nov 24, 2015.

  1. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Its great. But wirhout tabs its just anoying to work with. Are there any plans to add tabs?
     
  2. The-Little-Guy

    The-Little-Guy

    Joined:
    Aug 1, 2012
    Posts:
    297
    @Sajid that is the Asset Store Plugin that is causing the popup.

    I am running vscode without the Asset Store Plugin, and it seems to be working fine...
     
  3. The-Little-Guy

    The-Little-Guy

    Joined:
    Aug 1, 2012
    Posts:
    297
    The tabs are on the left hand side (or right if you changed the settings) under working files.

    That is a vscode feature not a Debugger feature
     
  4. sfjohansson

    sfjohansson

    Joined:
    Mar 12, 2013
    Posts:
    369
    The lack of tabs has nothing to do with the unity extensions..Not having tabs is Microsoft's decision.. I missed them too as I'm using a 24" in portrait for code..

    I can therefore recommend Consulo...which is based on IntelliJ... If you are looking for an alternative to Monodevelop

    It's super... has tabs...here is the thread:

    http://forum.unity3d.com/threads/consulo-ide-intellij-idea-based-ide.275472/
     
    Der_Kevin likes this.
  5. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    ahhhhh :-o
    thanks! ;)
     
  6. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    You need to remove the last comma on line 8, after "launch"
     
  7. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    632
    It works perfectly minus the focus issues, can we expect an integration with dotBunny's implementaion:
    https://github.com/dotBunny/VSCode
    Or maybe even better make a global plugins folder for Unity so we don't have to import each plugin to each project folder.
    Thanks.
     
  8. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    We will be looking into supporting VS Code out of the box in Unity. But I am unable to say when this will happen, as I do not know and it is not something we are currently working on.
     
  9. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    632
    That's the optimal solution, thanks.
     
  10. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    I just tested VS and so far it's really great ! I just have one weird issue, the IEnumerator type is not recognized by VS - is that normal ?

    Thanks.
     
    Last edited: Dec 16, 2015
  11. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Ok - my bad - I didn't manually import System.Collection which is required to use Coroutine.
     
  12. ophilbert_ohbibi

    ophilbert_ohbibi

    Joined:
    Apr 25, 2014
    Posts:
    1
    I tried VSCode when it was released but I was annoyed not having the capability to resolve missing reference (auto add using statement such as "using UnityEngine;" when typing Vector3 or such)

    Is this supported by the VSCode? Have I missed something?
     
  13. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Just open the project through Assets > Open C# Project, it uses the default script editor.
     
  14. VorT3x

    VorT3x

    Joined:
    Mar 10, 2015
    Posts:
    2
    Tried it, works awesome! Thanks!
     
  15. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    632
    Intellisense is broken with me, shows all references are missing,
     
  16. The-Little-Guy

    The-Little-Guy

    Joined:
    Aug 1, 2012
    Posts:
    297
    In Unity, if you right click within your project and select "Open C# Project" does that fix it?
     
  17. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    You're welcome. :) It's almost foolproof! ;)

    (Well, except intellisense isn't working for me yet... at least I can open scripts in Linux now!)
     
  18. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741
    Search for mono runtime in our package manager, it is needed for a intellisense
     
  19. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Really? Looks like I'll be jumping to Linux before I turn my machine off then... What's the package name?
     
  20. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741
    I don't know the exact package name, that is just my assumption since on other platforms the latest mono needs to be installed first
     
  21. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    632
    No it's not working, I did everything right.
     
  22. avatar-

    avatar-

    Joined:
    Feb 26, 2014
    Posts:
    1
    How does this compare with Visual Studio 2015? Is it primarily for people who can't VS2015 for some reason or are there people who actually prefer it?
    I've been using VS for 20+ years and I have yet to find anything that comes close VS+Resharper for C#.
    But I would certainly investigate any opportunity to improve my dev environment.
     
  23. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741
    Well i think VS + ReSharper is the best you can get atm. But most as using VS CODE as a alternative to MonoDev when using osX.

    Also i find without resharper VS is kinda meh, and Code is nice and lightweight and starts fast, unlike VS proper.
     
  24. ratmat2002

    ratmat2002

    Joined:
    Jun 13, 2014
    Posts:
    35
    UnityDebug keeps disconnecting from the Unity process 5 seconds after clicking the green arrow in VSCode.

    I'm running Unity 5.2.2p3 on OS X with the latest Mono 4.2.1 framework installed. Here is the output of UnityDebug-log.txt. Any idea how to fix this?

    14:15:20.947019: UnityDebug
    14:15:22.533480: Failed to load: PlaybackEngines/iOSSupport/Data/iosdevices.csv
    14:15:22.534637: Error while initializing usbmuxd
    14:15:22.535369: Found Unity process: AndroidPlayer(asus_Nexus_7@192.168.160.112) (1410803935)
    14:15:22.535467: Found Unity process: iPhonePlayer(admins-iPhone) (2216511814)
    14:15:22.535572: Found Unity process: Unity Editor (Unity) (77004)
    14:15:22.545198: UnityDebug: Attached to Unity process 'Unity Editor (Unity)' (77004)
    14:15:27.084628: UnityDebug: Disconnected
     
  25. ratmat2002

    ratmat2002

    Joined:
    Jun 13, 2014
    Posts:
    35
    Update: I was able to get the debugger to work by upgrading to Unity 5.3.1p1.

     
  26. Deleted User

    Deleted User

    Guest

    呵呵,原来是 宣雨松。
     
  27. Deleted User

    Deleted User

    Guest

    大胡子哥哥是谁? 来得够早的 2013 年就来论坛了
     
  28. nomenonX

    nomenonX

    Joined:
    Mar 17, 2015
    Posts:
    14
    after adding a Watch
    I already have .net 4.5/4.6, mono 4.2.1, gtk-sharp 2.12.26

    error while processing request 'evaluate' (exception: Could not load file or assembly 'ICSharpCode.NRefactory.CSharp, Version=5.0.0.0, Culture=neutral, PublicKeyToken=d4bfe873e7598c49' or one of its dependencies. The system cannot find the file specified.)
    System.IO.FileNotFoundException: Could not load file or assembly 'ICSharpCode.NRefactory.CSharp, Version=5.0.0.0, Culture=neutral, PublicKeyToken=d4bfe873e7598c49' or one of its dependencies. The system cannot find the file specified.
    File name: 'ICSharpCode.NRefactory.CSharp, Version=5.0.0.0, Culture=neutral, PublicKeyToken=d4bfe873e7598c49'
    at Mono.Debugging.Evaluation.NRefactoryExpressionEvaluator.ValidateExpression(EvaluationContext ctx, String expression)
    at Mono.Debugging.Evaluation.ObjectValueAdaptor.ValidateExpression(EvaluationContext ctx, String expression)
    at Mono.Debugging.Evaluation.BaseBacktrace.ValidateExpression(Int32 frameIndex, String expression, EvaluationOptions options)
    at Mono.Debugging.Client.StackFrame.ValidateExpression(String expression, EvaluationOptions options)
    at Mono.Debugging.Client.StackFrame.ValidateExpression(String expression)
    at UnityDebug.UnityDebugSession.Evaluate(String context, Int32 frameId, String expression)
    at OpenDebug.DebugSession.Dispatch(String command, Object args)
    at UnityDebug.Program.<Dispatch>c__AnonStorey0.<>m__0(String command, Object args, IResponder responder)
     
    Last edited: Jan 9, 2016
  29. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    Thanks for reporting this issue. Looks like the NRefactory assembly should also be included.
     
  30. camillo777

    camillo777

    Joined:
    Apr 20, 2015
    Posts:
    10
    Hi!
    Can we see the "Debug.Log" messages in VS Code?
    Thankyou!
     
  31. Pi_3-14

    Pi_3-14

    Joined:
    May 9, 2012
    Posts:
    168
    Might the OP consider modifying the original post so that it discusses the https://github.com/dotBunny/VSCode/ plugin as documented here: https://code.visualstudio.com/Docs/runtimes/unity ?

    I believe this plug-in simplifies the installation process.

    However, I had got most of the way through this first post before someone on the IRC channel pointed out the plug-in exists. Now I'm not entirely sure I've set everything up correctly.
     
  32. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    This is currently not possible, but something we will look into supporting in the future.


    We will update the documentation once we publish this extension to the VS Code gallery.
     
  33. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
  34. nomenonX

    nomenonX

    Joined:
    Mar 17, 2015
    Posts:
    14
    Is still an issue when added a watch
    addwatch.png
     
  35. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    It is a bit unclear to me what expression you typed. If you want to evaluate fields on on the current object, e.g. "int fireRate" then you type "this.fireRate".
     
  36. nomenonX

    nomenonX

    Joined:
    Mar 17, 2015
    Posts:
    14
    hmm, it works! But if you add Watch through contex menu - error watch.png
     
    Last edited: Jan 20, 2016
  37. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    I will have look into this issue and see if this is something that can be fixed in the extension or if it is a issue within VS Code.
     
  38. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    I've fixed the issue with adding a watch through the contextual menu. The fix might no cover all cases, so if you find some that do not work, let me know. Version 1.0.1 has been uploaded.
     
  39. nomenonX

    nomenonX

    Joined:
    Mar 17, 2015
    Posts:
    14
    Now generally working well.These are not very important
    somewatches.png
     
  40. Deleted User

    Deleted User

    Guest

    It resets every time the launch.json, if I put the Unity debugger and put a hint and start debugging I get the information and is OK, but if I want to do again it resets the launch.json every time, please help to solve this issue!!
     
  41. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    I think this might be because you are using VS Code editor extension from dotBunny or something similar. You need to disable writing of the launch.json.
     
  42. Reapazor

    Reapazor

    Joined:
    Jun 19, 2008
    Posts:
    173
    Updated the VSCode plugin to support the debugger, and even install it for the user :)
    UAS version submitted for approval, GitHub as always, latest :)
     
  43. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    577
    Last time i checked debugger didnt work on windows, is that fixed?
     
  44. GilesDMiddleton

    GilesDMiddleton

    Joined:
    Aug 12, 2015
    Posts:
    91
    Does anyone know how to get Unity help-docs tied into VS Code accelerators? I miss being able to get context sensitive help lookup direct to the unity web site. I'm on a mac.
     
  45. lukaszunity

    lukaszunity

    Administrator

    Joined:
    Jun 11, 2014
    Posts:
    461
    This debugger extension works on Windows. The Mono debugger extension does not.

    Tobiah Zarlez made an extension for that: https://marketplace.visualstudio.com/items?itemName=Tobiah.unity-tools
     
    Last edited: Feb 8, 2016
  46. DalerHakimov

    DalerHakimov

    Joined:
    Mar 14, 2014
    Posts:
    302
    It keeps giving to me the pop-up message Vs Code Update whenever I run the Editor.. does anyone have any idea why?
     
  47. The-Little-Guy

    The-Little-Guy

    Joined:
    Aug 1, 2012
    Posts:
    297
    Did you update the editor? There was a recent update about a day or two ago v0.10.8
     
  48. jwittner

    jwittner

    Joined:
    Dec 2, 2015
    Posts:
    6
    I was seeing this same issue until I disabled the dotBunny/VSCode integration. Even if I had the Use Unity Debugger setting toggled it would end up disconnecting Code from Unity while that VSCode "Checking for Update" message hovered.

    For now I'm running without Unity integration so I can debug from Code.
     
  49. DalerHakimov

    DalerHakimov

    Joined:
    Mar 14, 2014
    Posts:
    302
    Yeah I can confirm this too.. Its dotbunny integration issue.. WHy would it want to check for vsCode update every time..

    @Reapazor, anything to add?

    EDIT:

    I found out a piece of code inside that dotbunny plugin, and simply commented out the update part.
    Code (CSharp):
    1.         static VSCode()
    2.         {
    3.             if (Enabled)
    4.             {
    5.                 UpdateUnityPreferences(true);
    6.                 UpdateLaunchFile();
    7.              
    8.                 // Add Update Check
    9.                 DateTime targetDate = LastUpdate.AddDays(UpdateTime);
    10.                 if (DateTime.Now >= targetDate)
    11.                 {
    12.                    // CheckForUpdate();
    13.                 }
    14.             }
    Seems like even if you uncheck the option for "Automatic Updates" inside the dotBunny plugin, it will check for update anyway... He should add one more "if statement" before to check for this update..

    For now I just commented out that part and it works as it should
     
    Last edited: Feb 11, 2016
  50. RichCodes

    RichCodes

    Joined:
    Apr 3, 2013
    Posts:
    142