Hi, today i tried to make a simple scene that would use networking, and i didnt get very far on it because im not sure of a few things:
Do i need a master server like SmartFox no matter what i do (dedicated server, etc)?
also here’s the scripts ive written and im not sure if they are written correctly or not, but i keep getting the error: The connection request to [IP : Port] failed. Are you sure the server can be connected to? and i really don’t know what the problem is here…
This is for the player prefab that is the LocalPlayer and starts the server.
function Awake () {
var useNat = !Network.HavePublicAddress(); // I don't know if i need his line or not..
Network.InitializeServer(32, 3233, useNat);
}
This is attached to the RemotePlayer
function Awake () {
Network.Connect("IP", 3233);
}
And this script instantiates the remote and local player prefabs
var LocalPlayer : GameObject;
var RemotePlayer : GameObject;
function Update () {
if (Input.GetKey("l")) {
Instantiate (LocalPlayer, transform.position, transform.rotation);
}
if (Input.GetKey("r")) {
Network.Instantiate (RemotePlayer, transform.position, transform.rotation, 0);
}
}
Again, im not good at this stuff so if you see anything wrong with anything on here (i’m almost positive there is a lot wrong with it) please tell me ![]()