public void ChangeOwner(ulong newOwnerPlayerId)
{
if (!allowOwnershipChange)
return;
// Only the current owner or server can change the owner of this object
if (!IsOwner && !OwningNetWorker.IsServer)
{
#if UNITY_EDITOR
Debug.LogError("Only the current owner or server can change the owner of this object");
#endif
return;
}
if (!OwningNetWorker.IsServer)
RPC("ServerChangeOwner", NetworkReceivers.Server, newOwnerPlayerId);
else
ServerChangeOwner(newOwnerPlayerId);
}