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:
    826
    Update: Unity Hub Version 2.2.2 resolves the problem

    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
     
    Last edited: Dec 18, 2019
    HitGrab1 likes this.
  2. Mark-Ripley

    Mark-Ripley

    Joined:
    Aug 22, 2007
    Posts:
    148
    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:
    148
    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:
    826
    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?
     
  6. RedHatJef

    RedHatJef

    Joined:
    Jun 11, 2019
    Posts:
    4
    We saw this issue as well. Ensuring that git (the correct version) is in the path and works from a base command line was the first step we took. Booting unity directly (not via Unity Hub) seems to have allowed us to get beyond the issue by installing UPM packages. Subsequent unity hub starts worked (probably because it wasn't trying to install a UPM package). I suspect, as I think others have, that the environment Unity Hub sets up is not quite right with recent changes.

    The way this fails results in a debugging path that has a very high cost - experiments to try to fix mean uninstalling/reinstalling unity, unity hub, git, or a whole code repository. Would be super nice to get this fixed ASAP so others don't stub their toes like we did.
     
  7. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Apparently the problem has been fixed for 2.2.2 (https://forum.unity.com/threads/where-is-releace-candidate-2.791439/#post-5279286). I sadly don't get an update for my hub somehow, so not sure if it is really released yet.

    Edit 18.12.2019: Got the Hub Update for 2.2.2 now, and indeed the git problem is now fixed for my case :)
     
    Last edited: Dec 18, 2019