I’ve been able to get Unity 5.1 networking to connect on two different builds on a single computer, but when I run the builds, one on my laptop, and the other on my desktop they don’t connect with each other. How do I go about getting Unity’s new networking to connect to each other from both computers?
I struggled with this for a while, a few things you need for LAN:
**- Goto multiplayer.unity3d.com and sign up for a new game, which will get you a UNET ID. Even for LAN games without using matchmaker **
-Edit → Project Settings → Player, apparently you can put it there which I couldnt see, for me it was In the ‘Services’ tab inside Unity which is near the inspector usually, enter your ID and link the game with it. There will be a multiplayer section that you can click on to see its all set up . (You will have to log in with your unity login)
- On windows, in command prompt type ‘ipconfig’ to get your internal IP address for the computer which will be the host, usually 192.168.0.something
- if using the networking HUD, put this 192 number into the space where it says localhost, and click the client button (for the client) after you have the host running
I had the same issue. Locally on my laptop, I would run the server and client just fine in two separate applications (editor + standalone) but it would fail to work when running the server on my laptop and a client on my android phone.
As it turns out, the default NetworkDiscovery implementation does not work correctly out of the box. While it will show you the correct broadcasted IP when you listen in (with their debug GUI), when you attempt to join it, it always tries to join with ‘localhost’ as the network address.
The solution for me was simply to override the default implementation and set the NetworkManager.singleton.networkAddress with the received broadcast address, more or less exactly as documented here: http://docs.unity3d.com/ScriptReference/Networking.NetworkDiscovery.html
Note that you’ll likely want to stop the broadcasting after your connection attempt to avoid reconnecting every time you receive a new broadcast.
Hi ! you should use Photon Asset .
It took me a little bit of research to learn about the different internet settings on my computer. I was finally able to get a test game to connect and sync on both my laptop and desktop by using my internal IP instead of external IP. Thanks for helping me figure this out. If you reply back under the answer area, instead of the comment area, I should be able to accept your answer as the best answer.
Is it necessary to connect to a 3rd party such as photon or multiplayer.unity3d.com? I want to run over a switch at college which will send traffic local amongst computers but it can’t connect to the internet because of port blocking issues. Is it even possible to use Unity multiplayer anymore without having to connect to an online service?