0

I am new to UNET UNITY NETWORKING in general so what I made was a simple prototype game and everything works perfectly at least at that moment when I run two instances of the game on the same laptop so i was able to host and join form one instance to another

take a look here

so it did exactly what I expected but when used another laptop and connected to the same wifi I couldn't join with the hosted device anymore, i also tried it on mobile but the same thing happened

this is what it says when i run the game on two devices

this is what it says when i run the game on two devices

derHugo
  • 83,094
  • 9
  • 75
  • 115
The Wolf
  • 55
  • 1
  • 2
  • 6

1 Answers1

0

You are trying to connect to localhost (the devices local address). That obviously doesn't work for connecting to another device.

You have to configure the IP/Address of the device that will later actually be hosting the game in the NetworkManager component:


Alternatively I can recommend the

NetworkManagerHUD component (has to be attached next to the NetworkManager component on the same GameObject)

so in the game you can still dynamically adjust the host IP/Address as shown in Using the NetworkManagerHUD:


Or if you want to go crazy you can instead also use the NetworkDiscovery to auto-discover a host in your local network (LAN - doesn't work for internet connections).

Easiest mode simply make sure to enable Use NetworkManager

Enable this to use the Network Manager settings for broadcasting, and to then auto-join found games.

otherwise you can also implement your own script for handling the sending and receiving of broadcast messages.


UNet deprication

In general keep in mind that

UNet is deprecated, and will be removed from Unity in the future. A new system is under development. For more information and next steps see this blog post and the FAQ.

derHugo
  • 83,094
  • 9
  • 75
  • 115