Open Yoraiz0r opened 1 month ago
@Yoraiz0r This we were aware of for the DAHost. The DAHost mode is something that is more for development purposes than it is for a live service connection. (which will be available to use soon)
However, the next exp release will have this issue removed. (Thank you for the detailed explanation) 👍
Description
Using NGO 2.0.0-exp2 with Distributed Authority, Assuming Alice hosts with Distributed Authority mode, And Bob joins, And there is a
NetworkObject
owned by Bob with theTransferrable
flag, withoutRequires Permission
, And Bob callsChangeOwnership(Alice)
Bob will get a warningUnnecessary ownership changed message for {NetworkObjectId}
Reproduce Steps
NetworkManager
inDistributed Authority
mode, and buttons to host, and join said hostNetworkBehaviour
that allows to send ownership of the object holding it to another client (Such as Alice to Bob, Bob to Alice) by callingNetworkObject.ChangeOwnership(otherClientId);
NetworkObject
with theTransferrable
flag, but withoutRequest Required
flag, and add theNetworkBehaviour
Unnecessary ownership changed message for {NetworkObjectId}
.Actual Outcome
Client gets a warning after transferring ownership of its object to the host
Expected Outcome
Client gets no warning after transferring ownership of its object to the host
Environment
Additional Context
I've locally pulled the package and checked the cause, This is because the Distributed Authority Host (DAHost), in
Unity.Netcode.ChangeOwnershipMessage.Handle
, is set to relay messages to other clients, with checks to skip under certain conditions, but this specific case is excluded. I've cleaned up the massive if check in it to the following:Case 1 assumes that we should ignore the Owner, instead of the Sender. This is erroneous, for one of two reasons:
ChangeOwnership
method should not be exposed, and a new methodClaimOwnership
that forces it towards the local client, should be exposed.For the time being, I've added a 4th case like so:
I'm not sure if this is entirely correct, but it feels correct for and resolves the problem for the time being.