hi I am making a RTS style game where you build armies/bases and attack your friends/enemies army/base(I was making this on DellanX, but the password for the login was mest up, so I created a new account). I am having trouble with sending my variables to the network. In this case I am sending each players name, faction name, color, and alliance to the network. I need all players to be able to see eachothers name/army/faction, but I cant seem to figure it out. I know very little about RPC, and I dont have enough knowledge to use it to solve this problem.
EDIT:
in case you didn’t see the comment below
I attempted to figure out RPC, but am having problems. I am Using arrays to store players, but when I connect to my server my variables arent changed. I am using code like:
public ArrayList PlayerName = ArrayList public string MyName = ""; //Script for GUI here
void OnServerInitialized(){
MyName = "BLUE";//For identification
networkView.RPC("SetServerInfo",RPCMode.All);
}
void OnConnectedToServer(){
MyName = "RED";//For identification
networkView.RPC("SetServerInfo",RPCMode.All);
}
[RPC]
void SetServerInfo(){
PlayerName.Add(MyName);
Debug.Log(PlayerName[0])//Show What the first name stored is
}
When I run my program as server I get in my log:
BLUE
When I run my program as client I get:
RED
What am I doing wrong? and what do I need to do to fix it???