- Home /
setting your own masterserver up
I have downloaded the latest masterserver from the unity website: http://unity3d.com/master-server/index.html.
However i tried to follow that topic: http://answers.unity3d.com/questions/43440/setting-your-own-masterserver-up.html
i added that codes:
private var MasterServer.ipAddress = "127.0.0.1";
private var MasterServer.port = 23466;
private var Network.natFacilitatorIP = "67.225.180.24";
private var Network.natFacilitatorPort = 50005;
and i got that error in this line:
private var MasterServer.ipAddress = "127.0.0.1";
Assets/Networking Scripts/ConnectGuiMasterServer.js(22,25): BCE0043: Unexpected token: ..
Please can anyone help!
Answer by Matt-Downey · Aug 09, 2012 at 11:46 AM
The issue is that you are trying to redefine an already defined variable.
Lets say unity has a variable transform.position, what you are essentially trying to say is private var transform.position = Vector3.zero, when in reality you're supposed to leave out the "private var" part.
Take out all of those "private var" 's, and your problem might be solved.
Well, I can definitely say that the Unexpected token is ".", which means that it MUST be the period between MasterServer and ipAddress, since the other ones are in quotation marks and would be ignored since periods can be used within "String"-types.
http://docs.unity3d.com/Documentation/ScriptReference/MasterServer-ipAddress.html
A little more info while I'm at it:
You cannot define a variable like this:
private var a.b : float = 1;
this is because the "." is used as an address, you can make a class A with variable b, then a variable a of class A and finally describe b in a, but you cannot do the aforementioned move all in one go.
thus for the same reason you cannot do:
private var MasterServer.ipAddress : String = "127.0.0.1";
because you are using a "." in the middle.
Furthermore even if you could "MasterServer.ipAddress" (and "MasterServer" for that matter) already exists, so Unity would say no regardless.
Also this kind of initialisation should be done in Start.
Answer by landon912 · Aug 10, 2012 at 08:42 PM
it should just be MasterServer.ipAddress = "127.0.0.1"; since MasterServer.ipAddress is already defined and you want to just change it.