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?