Skip to content

fix: Distributed Authority codec tests not using message version #3109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,14 @@ public IEnumerator NamedMessage()
[UnityTest]
public IEnumerator NetworkVariableDelta()
{
var component = Client.LocalClient.PlayerObject.GetComponent<TestNetworkComponent>();
var message = new NetworkVariableDeltaMessage
{
NetworkObjectId = 0,
NetworkBehaviourIndex = 1,
DeliveryMappedNetworkVariableIndex = new HashSet<int> { 2, 3, 4 },
NetworkObjectId = Client.LocalClient.PlayerObject.NetworkObjectId,
NetworkBehaviourIndex = component.NetworkBehaviourId,
DeliveryMappedNetworkVariableIndex = new HashSet<int> { 0, 1 },
TargetClientId = 5,
NetworkBehaviour = Client.LocalClient.PlayerObject.GetComponent<TestNetworkComponent>(),
NetworkBehaviour = component,
};

yield return SendMessage(ref message);
Expand Down Expand Up @@ -569,7 +570,7 @@ public IEnumerator SceneEventMessageObjectSceneChanged()

private IEnumerator SendMessage<T>(ref T message) where T : INetworkMessage
{
Client.MessageManager.SetVersion(k_ClientId, XXHash.Hash32(typeof(T).FullName), 0);
Client.MessageManager.SetVersion(k_ClientId, XXHash.Hash32(typeof(T).FullName), message.Version);

var clientIds = new NativeArray<ulong>(1, Allocator.Temp);
clientIds[0] = k_ClientId;
Expand Down Expand Up @@ -625,7 +626,8 @@ public void OnBeforeSendMessage<T>(ulong clientId, ref T message, NetworkDeliver
}

var writer = new FastBufferWriter(1024, Allocator.Temp);
message.Serialize(writer, 0);
// Serialize the message using the known message version
message.Serialize(writer, message.Version);

var testName = TestContext.CurrentContext.Test.Name;
if (!m_ExpectedMessages.ContainsKey(testName))
Expand Down
4 changes: 2 additions & 2 deletions testproject/ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 6000.0.10f1
m_EditorVersionWithRevision: 6000.0.10f1 (413673acabac)
m_EditorVersion: 6000.0.23f1
m_EditorVersionWithRevision: 6000.0.23f1 (1c4764c07fb4)
Loading