I am writing a script that sends information about the number of players connected to the server to clients that are connected to the server, which I am trying to do by using OnSerializeNetworkView, except it doesn’t seem to be working. I have tried researching this but there doesn’t appear to be much information on it. If anyone could give me a few clues as to how to do this that would be great.
My code for sending the variable (number of players) so far is this.
function OnSerializeNetworkView(stream : BitStream, info : NetworkMessageInfo) {
stream.Serialize(numOfConnectedPlayers);
}
This script is a component of a GameObject with a NetworkView attatched, which both the client and the server access by GUIs