Hey all. I am working on a radar script that uses the tags of an object to draw dots. Here is my situation currently:
Player A joins and is assigned Team 1
Player B joins and is assigned Team 2, this calls a Network.Instantiate on all clients
The problem I am having is that Player B instantiates without any team info or tag info on Player A’s screen.
The teams are tracked in a script called PlayerInfo.cs, so Player A would have his ship with Team 1 and a copy of Player Bs ship with no info at all.
Here is my question, can I serialize tag information across the network? I have this code:
void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info){
if(stream.isWriting){
if(team == "team1"){
newteam = 1;
} else if(team == "team2") {
newteam = 2;
} else {
newteam = 3;
}
Debug.Log(team + " " + newteam);
stream.Serialize(ref newteam);
} else {
stream.Serialize(ref newteam);
Debug.Log(newteam + " Serialized");
}
}
But all that seems to happen is that Player A’s ship serializes data, and then Player A’s copy of Player B’s ship also tries to serialize data. So in the end I get no data from Player B to Player A at all. Is Serialize only local? How would other people solve this problem?
Thanks for any help ![]()