Sections in this post:
-
Unity 2022.1 and up
-
LTS Releases
-
Firewall Suggestions
-
Blocked Ports & Timeout Suggestions
-
Legacy
-
Proxy Suggestions
-
Unity Hub Suggestions
- Unity 2022.1 and up
In Unity 2022.1.0a14, we removed the HTTP communication layer between Unity and the Unity Package Manager. We now use an OS-level IPC approach in order to solve a number of connectivity issues.
For older Unity versions where HTTP is still used, please see the sections “LTS Releases” and/or “Legacy” below.
- LTS Releases
This section applies to Unity LTS releases:
- 2018.4 (2018.4.18f1 and up)
- 2019.4 (2019.3.4f1 and up)
- 2020.3 (since 2020.1)
In these Unity versions, the Unity editor communicates with the Unity Package Manager over HTTP. Under some scenarios, this can lead to connectivity issues resulting in the following error message:
Could not establish a connection with the Unity Package Manager local server process. This is most likely due to a proxy or firewall configuration. Make sure the process […] is reachable via HTTP on the IP address 127.0.0.1.
Below are some troubleshooting tips for HTTP connectivity issues.
2.1 Firewall Suggestions
On Windows, there is often a firewall enabled by default called Windows Defender Firewall. This firewall can prevent inbound and outbound HTTP connections for specific applications. For this reason, when installing a Unity editor via the Unity Hub, the Hub automatically adds a rule to Windows Defender Firewall which allows inbound connections to the Unity editor:
To view your inbound rules:
- Control Panel > Windows Defender Firewall > Advanced settings > Inbound Rules
If you see your Unity editor version is blocked (red circle icon), click “Properties” in the right-hand pane and under “Action”, select “Allow the connection”.
If you don’t see a rule for your Unity editor version, try creating one with the steps below:
- Click “New Rule…”
- For “Rule Type”, select “Program”
- For the program path, enter the complete path to the Unity editor installation
- For “Action”, select “Allow the connection”
- For “Profile”, select all rules (Domain, Private, Public)
- Give the rule a name e.g. “Unity 2019.3.0a1 Editor”
Important: Some users have reported that even with an existing rule for their Unity editor version, it appears that Windows Defender Firewall is still preventing inbound connections coming from UPM. Some users have found that deleting the existing rule and re-creating it has fixed this.
2.2 Blocked Ports & Timeout Suggestions
Some users have reported that Unity is not able to start communicating with Package Manager in the allotted 10 seconds that we allow during startup. To find out whether this is happening, you can try starting Package Manager manually and then connecting to Unity. In a terminal or command prompt, run the following:
Windows
<path-to-unity-installation-dir>\Data\Resources\PackageManager\Server\UnityPackageManager.exe
Mac
<path-to-unity-installation-dir>/Unity.app/Contents/Resources/PackageManager/Server/UnityPackageManager
By default, this will start Package Manager on port 10010. You can also specify your own port with -p
e.g:
UnityPackageManager -p 3000
Now that Package Manager is running, try browsing to http://localhost:10010/health (replacing 10010 with your own port number if needed) to check that Package Manager is responding.
Finally, you can tell Unity to connect to your instance of Package Manager by running the following command:
Windows
<path-to-unity-installation-dir>\Unity.exe -upmServerPort 10010
Mac
<path-to-unity-installation-dir>/Unity.app/Contents/MacOS/Unity -upmServerPort 10010
Make sure to replace 10010 with your own port number if you set one.
If you are able to start Unity with the above steps, that means either the 10 second timeout we allow to start Package Manager is not enough or that a port (or range of ports) was blocked by a firewall. Please tell us on the forums or submit a bug and include this information.
Note: As of the versions below, the 10 second timeout was removed:
- 2020.2.0f1
- 2020.1.8f1
- 2019.4.12f1
- Legacy
The following section applies to Unity releases before 2020.1.0f1, 2019.3.4f1 and 2018.4.18f1.
3.1 Proxy Suggestions
A proxy server (for example on a corporate network) may be redirecting HTTP traffic from your machine. If the proxy is intercepting traffic on http://127.0.0.1 then the Unity editor may be unable to communicate with UPM. For this reason, Unity automatically bypasses the proxy for Unity Package Manager requests.
However, in previous Unity versions, the proxy bypass could be overridden using the environment variable NO_PROXY
or UNITY_NOPROXY
. If you have these variables set, please ensure that their values include 127.0.0.1. For example:
UNITY_NOPROXY=localhost,127.0.0.1,google.com,my-no-proxy-domain.com
Important: Some users have reported that even without setting the UNITY_NOPROXY
variable, Unity could not communicate with UPM and that explicitly setting the variable like so fixed their issue:
UNITY_NOPROXY=localhost,127.0.0.1
Important: Some users have said to ensure both localhost and 127.0.0.1 are present, and localhost is listed first.
To set environment variables on Windows:
-
Via command line:
-
Open Start menu > Type “cmd” > open Command Prompt
-
Type the following command and press enter:
-
setx UNITY_NOPROXY localhost,127.0.0.1
- Via Windows settings:
- Open Start menu > Search “Edit environment variables for your account”
- Under “User variables”, click “New…” > For “Variable name”, type “UNITY_NOPROXY” > For “Variable value”, type “localhost,127.0.0.1”
To set environment variables on Mac, see the instructions in [this post](https://discussions.unity.com/t/723294) .
3.2 Unity Hub Suggestions
Unity Hub version 2.2.0 changed the way that environment variables were passed to the Unity editor. This caused issues for some users since the user's own environment variable values might get overridden. If these were proxy-related environment variables, this may have prevented Unity from connecting to UPM.
Unity Hub version 2.2.2 fixed this issue so that user and system environment variables were preserved when starting the Unity editor. If you have an older version of Unity Hub, please consider upgrading to version 2.2.2 or greater.