Search Unity

Package manager is barley usable due to VPN and other proxies

Discussion in 'Package Manager' started by Hertzole, Feb 20, 2020.

  1. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Hello

    The package manager (and Unity as a whole) has a serious problem with VPN/proxies. Personally I'm using NordVPN and it's already been mentioned that Unity has issues with it. I even have to use workarounds to even open Unity. Now this problem is amplified with the introduction of the package manager.

    My experience is that I'm always "offline". I can search for packages, download and update packages without any problems. But I can never check the documentation or changelogs without actually downloading the package because the "package isn't available offline".

    Now with Unity 2020.1, you have to use the package manager for the asset store. Now that is completely broken. It won't allow me to search, update or download my assets. This was also brought up in the 2020.1 alpha forum.

    Now personally, I can just turn off my VPN when I need to. It's not really a big deal for me. It's still annoying but I'll live with it. Now the problem is bigger for those that are behind some company proxy or something. I've seen several users saying they have trouble with connection related stuff because of company proxies. At that point, it becomes a bit harder to just "turn it off".

    This has been an issue for a long time now and should be fixed. It would really increase the quality of life when using Unity.

    I also don't want this post to become a "why use a VPN" discussion. This is more of an issue than just Unity vs VPNs
     
  2. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,799
    The corporation proxies I deal with dont handle sending in login credentials, and for whatever reason I no longer can login, can no longer start unity in a reasonable timeframe as it cant get at the package manager and other things so it can take 5+ minutes to start, given next to everything useful is a package, I cant get at them nor download anything from the asset store. Whereas I used to be able to do fun stuff in unity, now, now I cant even amuse myself in my lunch break
     
    pouyash and Hertzole like this.
  3. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Please don't ignore this.
     
  4. supita_unity

    supita_unity

    Unity Technologies

    Joined:
    Dec 13, 2019
    Posts:
    226
    Hey @RealMTG ,

    I'm sorry you are experiencing this issue. Can you please help me out to understand what's the behaviour you have on your end, I would love to have more information about it: which Unity version are you using, what's the work around you have to do to get the Package Manager running?

    Maybe even including the editor and upm logs would help me to figure out better how to fix this.

    Thanks in advance,

    Supi
     
  5. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    The behavior I'm experiencing is quite weird.
    When dealing with normal packages, it always says I'm offline (even though I clearly have an internet connection). I can't check changelogs, documentation, or package licenses unless I download packages because "they aren't available offline". But I can still fetch all the packages and I can download/update them without any problems.
    Then with the new "My Assets" tab, I can't use it at all. It fetches the first page of assets but I can't download them. I can import them if I've already downloaded them.

    The packages problem has been there since the first day of the package manager, back in 2018.1 (I think it was that version it appeared?). It has persisted all the way to 2020.1 alpha (which prompted me to post this because I literally can not download assets at all in that version due to the removal of the asset store browser.)

    My workaround is either...
    A: Turn off my VPN (because for me this only happens when using NordVPN)
    or
    B: Use OpenVPN to connect, because then I can actually start up the Unity editor, which it refuses to do because of something in the shader compiler.
    As mentioned, all these problems only occur when using a VPN or when you're behind some company proxy, which I would believe is a lot harder to work around. I don't have any experience with that but it seems @bugfinders have more experience with that.
    There have been previous threads mentioning how Unity by itself outright doesn't work with NordVPN, so I believe it could most likely be related to the same issue. I don't know how it works with other VPNs because I don't have access to any others to test with.

    I have attached the editor log and the upm log, but unfortunately, I don't see anything that's helpful. Maybe you can find something in it.
     

    Attached Files:

    bugfinders likes this.
  6. supita_unity

    supita_unity

    Unity Technologies

    Joined:
    Dec 13, 2019
    Posts:
    226
    Hey @RealMTG ,

    Thanks a lot for providing the logs. Unfortunately, this is a problem with the Editor, and it’s beyond the Package Manager :(

    What is preventing Unity to launch in your case is not the lack of connectivity between Unity and the Package Manager server. In the Package Manager, we don’t control the check for connectivity, if the editor is not able to connect, you won’t have access to navigate to the change log, documentation, visiting the asset store.

    I’m sorry, I wish I could be more helpful honestly.

    Supi
     
    bugfinders likes this.
  7. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Hey
    I suspected as much that the editor would be the main problem. If anything, this problem with the package manager just showcases a bigger problem with the editor itself. If it would be possible, it would be great if the issue could get elevated in some way. It now outright knocks out an entire function of the editor with no workaround in some cases.

    Thanks for showing interest in helping though!
     
  8. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    It may seem like I've found a workaround on top of my already existing workaround. Big emphasis on may. I've had solutions that seem to work before but suddenly stop working but this one has worked for a longer time.

    So when trying to find a solution to literally everything else on my PC not working, I stumbled upon this on Windows Central forums and the solution seemed to work with my Windows apps and also made the package manager in Unity work as intended. I'm no longer offline! And YES, even the new "My Assets" tab works!

    In short, here's what you have to do:
    1. Open up CMD and type
      ipconfig /all
      and get the default gateway IP on your regular connection.
    2. Find your VPN TAP (in my case OpenVPN TAP) in Control Panel - Network and Internet - Network and Sharing Center - Change adapter settings (on the left side). Then right-click it and go to Properties.
    3. Select Internet Protocol IPv4 and click Properties. Click the 'Advanced' button at the bottom and go to the IP Settings Tab in the new windows that pops up.
    4. Click Add under the second box and enter the IP from your default gateway.
    5. Click OK on all the windows and you should be good to go. Probably a good idea to restart your PC for good measure.
    This worked for me and I can't promise it will work for others. I also tried doing the same with my normal NordVPN TAP but that didn't work. The shader compiler (why does the shader compiler need socket connections?!?) still doesn't allow Unity to open due to NordVPN.

    Hope this helps someone!
     
    supita_unity and bugfinders like this.
  9. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,799
    Well. whatever changed with 2019.3 and package manager broke it, as 2019.2.21 runs great any other version after.. wont start. The newer package manager just plain wont start
     
    Magic-Thor likes this.
  10. Magic-Thor

    Magic-Thor

    Joined:
    Mar 31, 2020
    Posts:
    15
    We have the same problem... Yes, it's 100% "package manager" and NOT the editor! We're using Surfshark...
     
    bugfinders likes this.
  11. Cec

    Cec

    Joined:
    Apr 7, 2014
    Posts:
    92
    Same issue for me with NordVPN. Quite annoying.
     
    Magic-Thor likes this.
  12. Shaunyowns

    Shaunyowns

    Joined:
    Nov 4, 2019
    Posts:
    328
  13. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,799
  14. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,799
    huh?
     
    JoNax97 likes this.
  15. DarkMemories

    DarkMemories

    Joined:
    Nov 13, 2020
    Posts:
    1
    I have the same problem. While using VPN I basically can't use the package manager.
     
  16. Magic-Thor

    Magic-Thor

    Joined:
    Mar 31, 2020
    Posts:
    15
  17. supita_unity

    supita_unity

    Unity Technologies

    Joined:
    Dec 13, 2019
    Posts:
    226
    Magic-Thor and Hertzole like this.
  18. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    You have no idea how happy this makes me! I no longer have to do workarounds that barley work. Great work to the devs that fixed this!
     
    Magic-Thor and supita_unity like this.
  19. Magic-Thor

    Magic-Thor

    Joined:
    Mar 31, 2020
    Posts:
    15
    supita_unity likes this.
  20. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Hi
    I was waiting for the 2020.2 fix of this issue and it finally got released yesterday. But much to my dismay, it's not fixed. The editor boots up now which is a step up from what it was before but once the editor starts, it just crashes. This happens when you're connected to the NordVPN app. The protocol doesn't matter.
    I've already reported a bug and the case number is 1308321.
     
  21. devZeropoint

    devZeropoint

    Joined:
    Feb 4, 2021
    Posts:
    3
    Hey guys. I've been having this issue while using vpn for almost a year and it's been very frustrating. I've found the solution that works for me. It happens so that the package manager server is working, but the UI is stupid.

    Here's how to fix it for 2021.3.11f1 on Windows
    Note: Other versions might have this in different places (like core unityedtior dll etc). But the idea should be about the same, find connectivity check, spoof it.
    Disclaimer: it's probably a very hacky and bad solution, don't do this unless desperate

    1. DnSpy. If you don't have it - head over to https://github.com/dnSpy/dnSpy/releases , grab a relevant release and open the app.
    2. Open your editor install folder and navigate to
    ...2021.3.11f1\Editor\Data\Managed\UnityEngine\
    Our target here is UnityEditor.PackageManagerUIModule.dll
    Drag and drop it into the dnspy window. (your unity editor should be closed)
    3. Find our main culprit. CheckInternetReachability method located inside ApplicationProxy class in UnityEditor.PackageManager.UI.Internal assembly
    Code (CSharp):
    1. private void CheckInternetReachability()
    2.         {
    3.             bool flag = EditorApplication.timeSinceStartup - this.m_LastInternetCheck < 2.0;
    4.             if (!flag)
    5.             {
    6.                 this.m_LastInternetCheck = EditorApplication.timeSinceStartup;
    7.                 bool flag2 = Application.internetReachability > NetworkReachability.NotReachable;
    8.                 bool flag3 = flag2 != this.m_IsInternetReachable;
    9.                 if (flag3)
    10.                 {
    11.                     this.m_IsInternetReachable = flag2;
    12.                     Action<bool> action = this.onInternetReachabilityChange;
    13.                     if (action != null)
    14.                     {
    15.                         action.Invoke(this.m_IsInternetReachable);
    16.                     }
    17.                 }
    18.             }
    19.         }
    Here we see a line
    Code (CSharp):
    1. bool flag2 = Application.internetReachability > NetworkReachability.NotReachable;
    which we're going to alter.

    Image shows dnspy window with the relevant method in view

    4. Time to edit IL opcodes.
    Note: I am new to IL editing, so there must be a cleaner way to edit this, but im not yet aware of it.
    Right click the CheckInternetReachability method name and select "Edit IL Instructions" to alter it's code
    You'll see a new window. Our interest here lies in opcodes 15 and 16

    Image shows dnspy IL view zoomed in on a relevant section with a highlight on opcodes 15 and 16
    15 - ldc.i4.0 loads 0 as operand because NotReachable is position 0 in the enum
    16 - cgt.un does the greater comparison

    Click the opcodes, this will show a handy menu to alter the codes.
    ldc.i4.0 becomes ldc.i4.8 (loads 8)
    cgt.un becomes clt.un (compares "less")
    The opcodes should be listed nearby, scroll a bit around.

    Image shows dnspy IL view zoomed in on altered opcodes with an opcode selection dropdown visible

    You're free to click "Ok" below the window.
    Once the window closes - we'll see the updated code which now reads
    bool flag2 = Application.internetReachability < (NetworkReachability)8;

    And this is exactly what we want, a check that always returns true
    //okay, not exactly, we'd want to just put true there. But it's close enough to what we want!

    Image shows dnspy code view, zoomed in on the altered code portion which now reads bool flag2 = Application.internetReachability < (NetworkReachability)8;

    Now you can close DnSpy. A propmt will appear asking whether you want to save the altered file. Click yes and enjoy your now-working package manager.

    Fun fact: The Application.InternetReachability script reference specifically states "Do not use this property to determine the actual connectivity."
     
    socialtrens likes this.
  22. devZeropoint

    devZeropoint

    Joined:
    Feb 4, 2021
    Posts:
    3
    Will try to take a look at other editor versions and post relevant changes in a couple of days