Skip to content

Commit bb6b109

Browse files
fix
Some minor tweaks for extracting the reliability used.
1 parent fbe8081 commit bb6b109

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

com.unity.netcode.gameobjects/Runtime/Messaging/Messages/NetworkTransformMessage.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public bool Deserialize(FastBufferReader reader, ref NetworkContext context, int
9898
// If we are the DAHost and the NetworkObject is hidden from the host we still need to forward this message.
9999
if (ownerAuthoritativeServerSide)
100100
{
101-
// We need to deserialize the state so we can send it to other connected clients (i.e. it will be re-serialized again).
101+
// We need to deserialize the state to our local State property so we can extract the reliability used.
102102
reader.ReadNetworkSerializableInPlace(ref State);
103103
// Fall through to act like a proxy for this message.
104104
}
@@ -151,7 +151,10 @@ public bool Deserialize(FastBufferReader reader, ref NetworkContext context, int
151151
ownerClientId = context.SenderId;
152152
}
153153

154-
var networkDelivery = State.IsReliableStateUpdate() ? NetworkDelivery.ReliableSequenced : NetworkDelivery.UnreliableSequenced;
154+
// Depending upon whether it is spawned locally or not, get the deserialized state
155+
var stateToUse = NetworkTransform != null ? NetworkTransform.InboundState : State;
156+
// Determine the reliability used to send the message
157+
var networkDelivery = stateToUse.IsReliableStateUpdate() ? NetworkDelivery.ReliableSequenced : NetworkDelivery.UnreliableSequenced;
155158

156159
// Forward the state update if there are any remote clients to foward it to
157160
if (networkManager.ConnectionManager.ConnectedClientsList.Count > (networkManager.IsHost ? 2 : 1))

0 commit comments

Comments
 (0)