Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How do I get the ECS source code to load in Visual Studio?

Discussion in 'Entity Component System' started by RaL, Aug 12, 2018.

  1. RaL

    RaL

    Joined:
    Nov 29, 2013
    Posts:
    35
    In the older beta versions, when I opened a game with ECS in Visual Studio, the ECS source code was always part of the VS solution (I guess there was one project per each assembly definition file). Now it seems to no longer be the case. So how can I load the ECS source along with my code in VS?
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,574
    Older beta of what? Unity beta 2018?
    You should be able to load, exactly same way, as any other script. That has not changed.
     
  3. RaL

    RaL

    Joined:
    Nov 29, 2013
    Posts:
    35
    If you create an empty project, install the ECS package via Package Manager and open the VS solution, there will be only one VS project in the solution. In the earlier beta versions your code and the ECS code were all together in a single solution in multiple VS projects. There were multiple projects, one for each assembly definition file. So that is what has changed.
     
  4. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    529
    Yes, asmdef files from packages don't get a project, but I don't think they ever did. Would be great if there would be an option to add them too.
     
    RaL and 5argon like this.
  5. RaL

    RaL

    Joined:
    Nov 29, 2013
    Posts:
    35
    Just FYI. I'm not sure if this can be solved in VS, but I've recently switched from Visual Studio to JetBrains Rider and I no longer have this issue - one of the many benefits of Rider is that when you open a project it also loads the source code of all the packages.
     
  6. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,695
    Anyone have a fix for ESC in VS this is driving me crazy
     
    Shinyclef likes this.
  7. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Yup. I too gave up with VS for unity for this and similar reasons like not being able to over-ride the .net that was being targeted. Very disappointing as a long time VS user but oh well. :( maybe they will update it
     
  8. psuong

    psuong

    Joined:
    Jun 11, 2014
    Posts:
    118
    Well a work around would be to use ILSpy extension in Visual Studio so you can open the solution/assembly, but it's not a solution for opening it directly in VS though.
     
    twobob likes this.
  9. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    908
    I made a copy of entities and added it as a local package.
     
    twobob likes this.
  10. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    3,983
    Edit->Preferences->External Tools->Generate all .csproj files
     
    twobob likes this.
  11. Enoch

    Enoch

    Joined:
    Mar 19, 2013
    Posts:
    198
    This should work for you if you just want to search across the files in question from VSCode but if you open up the .vscode directory in the root of your project (that is on step up .. from assets). There is a settings.json file in there. Set:
    "Library/":true,
    "library/":true,
    under files excludes both to false. I am not sure when unity overwrites this file but those changes seem to survive through multiple changes/compiles and it allowed me to search on anything in the packages folder.
     
    twobob likes this.
  12. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    190
    doesn't work for me... weird...(it did worked once until i restart my unity...)
     
  13. JPrzemieniecki

    JPrzemieniecki

    Joined:
    Feb 7, 2013
    Posts:
    33
    It works, but is incredibly unreliable and tends to break and reset to the default (only the Assembly-CSharp project in solution) whenever you add/remove a script file in the project window, or restart Unity.

    My workaround for now is to get it to work once (somehow), and copy the generated .sln, then whenever it reverts you can manually restore the copy. Needless to say this workflow is not great, but it's the best I've got right now.
     
  14. ow1

    ow1

    Joined:
    Nov 9, 2018
    Posts:
    4
    In VS menu Tools => Options => Text Editor / C# / Advanced / Analysis: check "Enable navigation to decompiled sources(experimental)". I found this works. I also checked "Enable full solution analysis", but maybe it's not required.