Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Feedback Improve "Open C# Project"

Discussion in 'Editor & General Support' started by Peter77, Dec 29, 2019.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,626
    I use Visual Studio 2019 as "External Script Editor" in Unity. When I click "Assets > Open C# Project" from Unity's main menu, it opens Visual Studio 2019.

    Depending on the Visual Studio Solution complexity, it sometimes takes several minutes until Visual Studio has finished opening the solution. During this time, while Visual Studio is opening the solution, Unity is unresponsive.

    "Unity is unresponsive" means I cannot work inside Unity during this time.

    Please improve "Open C# Project", so that the Unity editor keeps responsive while Visual Studio is opening the Solution and I can continue to work inside Unity editor while VS is opening the solution.
     
  2. Deleted User

    Deleted User

    Guest

    The same operation takes barely 15 seconds for my current project (21 scripts of various sizes). How many scripts does your contain?
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,496
  4. Deleted User

    Deleted User

    Guest

    I'm not sure I understand what you mean, both Unity and VS are independent from each other; you don't need to have Unity open to open your project solution in VS.
     
  5. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,626
    Only about 500 .cs files across 11 projects. I guess some of the slowdown is also caused by a few VS extensions I've installed, plus my computer isn't new.

    However, even if it takes 15s like in your case, we shouldn't be forced to wait for that. Every second Unity locks me out feels like an eternity and causes me to lose focus, which causes a degradation in my overall productivity.
     
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,496
    do you have some extra antivirus programs installed?

    also tested in regular c# app, to launch notepad.exe
    if useShellExecute is true, ~30ms, if its false, ~1ms

    maybe related,
    https://stackoverflow.com/a/9285229/5452781
     
  7. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,626
    Yes, I have Avira Anti Virus installed, but I also excluded the VS install directory from real time protection. I've also excluded my mostly used Unity projects from RT protection, but I don't feel a difference.

    Unitys issue is not that VS is slow, the issue is that Unity waits for it to finish. Since it's out of Unity's control how long another application takes to finish, they should use an approach that does not lock the editor during this time. Whether it takes 10, 15, 30 or 60 seconds all come down to the same problem: it locks me out of Unity.
     
    termway likes this.
  8. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,203
    Probably not much help, but there were different times where opening Visual Studio took significantly longer due to issues with the VS Tools for Unity. Specifically, I remember running into an issue where a significantly number of Assembly Definitions in my problem took VS forever to open. They ended up fixing that in a future version of VS Tools for Unity. It could be possibly worth checking whether downgrading to an earlier version of VS 2019, or getting the latest version of VS 2019, makes any difference.

    That doesn't address the main issue of desynchronizing the two, but assuming Unity won't change anything here, maybe it can help reduce the impact.