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

VSTU for Mac & Symlinked Script Files

Discussion in 'Code Editors & IDEs' started by mleesago, Jan 4, 2019.

  1. mleesago

    mleesago

    Joined:
    Jan 18, 2017
    Posts:
    10
    When using Visual Studio Mac as code editor for Unity and opening scripts that have been symlinked to be exposed to Unity project, intellisense does not recognize the script file to be part of the solution. So initially opening the symlinked script (by double clicking on the script file inside Unity Editor) using Visual Studio, you will see that intellisense does not work but if you search for the same file inside Visual Studio code editor and open that, which pretty much uses the same window as the file you initially opened, you will notice that now intellisense recognizes the script file as being part of the solution and everything works fine. Suspecting that it might have to do with how VSTU for Mac and its bridge code is being used to open scripts that have been symlinked.

    Attached an example project that illustrates this problem. If you open the project (on MacOS) and click "Link/Link Master" then it will expose "Code/master" folder to Unity via symlink, and target path being "Assets/Code". Then if you open "Master.cs" script file with Visual Studio, you will see that you can't use intellisense to navigate to the parent class that it inherited from. But if you search for the same script file, either from search bar located top right corner or using solution navigator to find the file, and then opening it will let intellisense pick up the script file and it works like normal again.

    Our team is aware that using symlink is generally not good but we need this for our project. So it would be good if intellisense can work for any symlinked script files without having to open them again inside Visual Studio code editor.
     

    Attached Files:

    Last edited: Jan 22, 2019
    Arthur-LVGameDev likes this.
  2. Arthur-LVGameDev

    Arthur-LVGameDev

    Joined:
    Mar 14, 2016
    Posts:
    228
    Sorry to necro, but +1.

    This makes developing a dot-net application, that shares code with a Unity application, extremely frustrating from a workflow perspective. If either Unity or VS could 'see' symlinked dirs, it'd be great. Can sort of work around it with asmdefs (ie after pulling in Nuget pkgs) -- but it's a PITA.

    The only other viable alternative is to constantly be building DLLs from the dot-net app and using post-build code to ship it to Unity, which is quite annoying and is far from optimal for workflow.

    Edit: It's ugly but, for now, we've resorted to using per-file hard-links (hard-links can't be used for dirs). Not pretty but it lets us edit the 'shared' code in either instance of IDE, and lets the code be visible on "both sides" too, and keeps .meta files separated only on the "Unity side". It's not pretty but eh. +1 for a better solution, though.
     
    Last edited: Jan 6, 2022