-
Notifications
You must be signed in to change notification settings - Fork 0
Setting Up Client & Host
I have made sure setting up a client/host is easier than ever!
First you must create a NetServer variable:
public NetServer server;
Then all you have to do is initialize the server, then start the server. Like so. ` server.Initialize();
server.StartServer(); `
I recommend making server a public variable so you can easily edit it within the Unity editor.
Setting up the client is as easy as the host. Simply create a NetClient variable:
public NetClient client;
Then all you have to do is initialize it, then connect to a server.
-
client.Initialize()
-
client.ConnectToServer(ip,port);
-
You can disconnect by using
client.DisconnectFromServer();
-
With both the NetClient/NetServer I highly suggest making them public variables, and editing them within the Unity editor.
-
Make sure "NetworkData" exists and is attached to a GameObject somewhere. It is needed for Instantiating prefabs.