- Home /
NetworkMessageInfo sender.guid set to empty string "" or "0"?
I'm seeing weird behavior in an RPC.
My function looks something like this (simplified):
[RPC]
void AddPlayer( Vector3 position, Quaternion rotation, NetworkMessageInfo info )
{
print(info.sender.guid);
}
This RPC is getting called from OnConnectedToServer
.
Sometimes info.sender.guid is set to a correct looking guid.
Sometimes info.sender.guid is "0" which I think corresponds to the sender being the same as the receiver, which doesn't seem to be a problem if that's the case (but I can't find that documented anywhere).
However at other times info.sender.guid is "". This happens on the joining client but not the server. I'm not sure why this is happening or how to work around it (I need the guid for uniquely naming and identifying some objects).
I think the problem might be that the guid hasn't been assigned at the time I call the RPC (I'm calling it from OnConnectedToServer
), but can't find any documentation about when the guid gets set.
Does the sender.guid of "0" correspond to the receiver being the sender or is something else going wrong?
Why is the guid blank for connecting clients (set to the empty string "")?
At what point does the NetworkPlayer guid get assigned in the connection process?
Would love to see the answer to this question-- particularly #3 on the list.
Just ran into this. Passing old networkPlayers to clients when a new client connects. The index value is correct but the guild is string.empty.
Answer by Matt- · May 02, 2012 at 10:28 PM
I'm working around it now by passing Network.player.guid
as a parameter to my RPC (so it's void AddPlayer( Vector3 position, Quaternion rotation, string netPlayerGuid, NetworkMessageInfo info )
).
But I'm still curious why it doesn't always come through correctly in NetworkMessageInfo.