Search Unity

UnityHub breaks git path for package manager

Discussion in 'Unity Hub' started by Johannski, Dec 4, 2019.

  1. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    596
    Since around version 2.2.0 (can't pinpoint the exact version, since I first didn't connect the problem with UnityHub) the package manager won't find git anymore. You can find more information about the problem here: https://forum.unity.com/threads/git-support-on-package-manager.573673/page-4#post-5239820

    I noticed that git will be found by the Package Manager, if the project is started throgh the Unity exe itself instead of the hub. Therefore I guess something is wrong with the hub.

    I tried uninstalling the hub, but I think I didn't manage to completly uninstall it, since the problem did not disappear and I was still logged in and had my project list when I reinstalled the hub.

    Since nobody else seems to have the problem, I hope that properly reinstalling the hub solves the problem.
    Here are the steps I took:
    - Uninstall with Revo Uninstaller to remove installation and leftover registry entries
    - Delete folder %AppData%\Unity Hub
    - Delete folder %AppData%\UnityHub
    - Delete folder content of %LocalAppData%\Unity\cache
    - Empty CacheServer Content

    Once I install the Hub and set my Unity installation folder, the project history is back and I'm logged in as well, so there seems to be something else.

    Why does this happen and can I fix it, or is this a bug of the Hub? I use the hub since the preview version and was always quick to update to the next version if that is relevant.


    About the Setup
    Unity: 2019.3.0f1, 2019.2.10f1
    UnityHub: 2.2.1
    Windows: Windows10 Pro 1909
    git version 2.24.0.windows.2
    git-lfs/2.9.0 (GitHub; windows amd64; go 1.12.7; git 8ab05aa7)

    Environment variables:
    C:\Program Files\Git\cmd
     
    HitGrab1 likes this.
  2. Mark-Ripley

    Mark-Ripley

    Joined:
    Aug 22, 2007
    Posts:
    118
    I've just upgraded to unity hub 2.2.1 and it's broken git AND all my Unity projects. Way to go, guys.
     
  3. Mark-Ripley

    Mark-Ripley

    Joined:
    Aug 22, 2007
    Posts:
    118
    Here's the fix:

    Go to the version of Unity you last ran, then down to Editor/Data/Tools/RoslynScripts, open up "unity_csc.bat" and add ".exe" to the end of the command it's calling, so it'll look like:

    @echo OFF
    set APPLICATION_CONTENTS=%~dp0..\..
    "%APPLICATION_CONTENTS%\Tools\Roslyn\csc.exe" /shared %*
    exit /b %ERRORLEVEL%

    How that manages to break git too is anyone's guess :)
     
    HitGrab1 and Pyroka like this.
  4. Pyroka

    Pyroka

    Joined:
    Oct 22, 2012
    Posts:
    3
    I had the same issue as Mark, my Unity projects all had some number of errors that looked like the attached image
    But wouldn't clear (like they were compile errors). The editor log was complaining about csc:

    "is not recognized as an internal or external command,
    operable program or batch file."

    but the path it was using (the path that the the above batch file command expands to) was fine when I ran it myself from CMD prompt.

    Re-installing unity failed to fix the issue, deleting the library didn't fix it either. I'm not sure what happened, but it's a fun one
     

    Attached Files:

  5. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    596
    Very interesting, that fixed it for you?
    I changed the script for 2019.2.14f1 and it didn't help. For 2019.3 the script looks a bit different:
    Code (bat):
    1. @ECHO OFF
    2.  
    3. setlocal
    4.  
    5. rem start with editor install layout
    6. set CSC=%~dp0..\..\Tools\Roslyn\csc.exe
    7.  
    8. rem fall back to source tree layout
    9. if not exist "%CSC%" set CSC=%~dp0..\..\csc\builds\Binaries\Windows\csc.exe
    10.  
    11. if not exist "%CSC%" (
    12.     echo Failed to find csc.exe
    13.     exit /b 1
    14. )
    15.  
    16. "%CSC%" /shared %*
    17. exit /b %ERRORLEVEL%
    18.  
    19. endlocal
    Looks correct to me... at least the .exe is always set.

    Just to be sure: Did you try adding a different repo or changing the version number? The packages are cached for each project and therefore won't need git in order to be imported.

    @Pyroka : Oh yeah, I had those errors without any content as well. Did you get your setup to work again?