com.unity.netcode.gameobjects@1.0.0-pre.6

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com).

## [1.0.0-pre.6] - 2022-03-02

### Added
- NetworkAnimator now properly synchrhonizes all animation layers as well as runtime-adjusted weighting between them (#1765)
- Added first set of tests for NetworkAnimator - parameter syncing, trigger set / reset, override network animator (#1735)

### Changed

### Fixed
- Fixed an issue where sometimes the first client to connect to the server could see messages from the server as coming from itself. (#1683)
- Fixed an issue where clients seemed to be able to send messages to ClientId 1, but these messages would actually still go to the server (id 0) instead of that client. (#1683)
- Improved clarity of error messaging when a client attempts to send a message to a destination other than the server, which isn't allowed. (#1683)
- Disallowed async keyword in RPCs (#1681)
- Fixed an issue where Alpha release versions of Unity (version 2022.2.0a5 and later) will not compile due to the UNet Transport no longer existing (#1678)
- Fixed messages larger than 64k being written with incorrectly truncated message size in header (#1686) (credit: @kaen)
- Fixed overloading RPC methods causing collisions and failing on IL2CPP targets. (#1694)
- Fixed spawn flow to propagate `IsSceneObject` down to children NetworkObjects, decouple implicit relationship between object spawning & `IsSceneObject` flag (#1685)
- Fixed error when serializing ConnectionApprovalMessage with scene management disabled when one or more objects is hidden via the CheckObjectVisibility delegate (#1720)
- Fixed CheckObjectVisibility delegate not being properly invoked for connecting clients when Scene Management is enabled. (#1680)
- Fixed NetworkList to properly call INetworkSerializable's NetworkSerialize() method (#1682)
- Fixed NetworkVariables containing more than 1300 bytes of data (such as large NetworkLists) no longer cause an OverflowException (the limit on data size is now whatever limit the chosen transport imposes on fragmented NetworkDelivery mechanisms) (#1725)
- Fixed ServerRpcParams and ClientRpcParams must be the last parameter of an RPC in order to function properly. Added a compile-time check to ensure this is the case and trigger an error if they're placed elsewhere (#1721)
- Fixed FastBufferReader being created with a length of 1 if provided an input of length 0 (#1724)
- Fixed The NetworkConfig's checksum hash includes the NetworkTick so that clients with a different tickrate than the server are identified and not allowed to connect (#1728)
- Fixed OwnedObjects not being properly modified when using ChangeOwnership (#1731)
- Improved performance in NetworkAnimator (#1735)
- Removed the "always sync" network animator (aka "autosend") parameters (#1746)
This commit is contained in:
Unity Technologies
2022-03-02 00:00:00 +00:00
parent 4818405514
commit 5b4aaa8b59
205 changed files with 6971 additions and 2722 deletions

View File

@@ -0,0 +1,66 @@
#if MULTIPLAYER_TOOLS
using System.Collections;
namespace Unity.Netcode.TestHelpers.Runtime.Metrics
{
internal abstract class SingleClientMetricTestBase : NetcodeIntegrationTest
{
protected override int NumberOfClients => 1;
internal NetworkManager Server { get; private set; }
internal NetworkMetrics ServerMetrics { get; private set; }
internal NetworkManager Client { get; private set; }
internal NetworkMetrics ClientMetrics { get; private set; }
protected override void OnServerAndClientsCreated()
{
Server = m_ServerNetworkManager;
Client = m_ClientNetworkManagers[0];
base.OnServerAndClientsCreated();
}
protected override IEnumerator OnStartedServerAndClients()
{
ServerMetrics = Server.NetworkMetrics as NetworkMetrics;
ClientMetrics = Client.NetworkMetrics as NetworkMetrics;
yield return base.OnStartedServerAndClients();
}
}
public abstract class DualClientMetricTestBase : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;
internal NetworkManager Server { get; private set; }
internal NetworkMetrics ServerMetrics { get; private set; }
internal NetworkManager FirstClient { get; private set; }
internal NetworkMetrics FirstClientMetrics { get; private set; }
internal NetworkManager SecondClient { get; private set; }
internal NetworkMetrics SecondClientMetrics { get; private set; }
protected override void OnServerAndClientsCreated()
{
Server = m_ServerNetworkManager;
FirstClient = m_ClientNetworkManagers[0];
SecondClient = m_ClientNetworkManagers[1];
base.OnServerAndClientsCreated();
}
protected override IEnumerator OnStartedServerAndClients()
{
ServerMetrics = Server.NetworkMetrics as NetworkMetrics;
FirstClientMetrics = FirstClient.NetworkMetrics as NetworkMetrics;
SecondClientMetrics = SecondClient.NetworkMetrics as NetworkMetrics;
yield return base.OnStartedServerAndClients();
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c726f5bc421c3874d9c1a26bcac3f091
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
#if MULTIPLAYER_TOOLS
using UnityEngine;
namespace Unity.Netcode.TestHelpers.Runtime.Metrics
{
public class NetworkVariableComponent : NetworkBehaviour
{
public NetworkVariable<int> MyNetworkVariable { get; } = new NetworkVariable<int>();
private void Update()
{
if (IsServer)
{
MyNetworkVariable.Value = Random.Range(100, 999);
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 124489f89ef59d449ab4bed1f5ef2f59
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,22 @@
using System;
namespace Unity.Netcode.TestHelpers.Runtime.Metrics
{
public class RpcTestComponent : NetworkBehaviour
{
public event Action OnServerRpcAction;
public event Action OnClientRpcAction;
[ServerRpc]
public void MyServerRpc()
{
OnServerRpcAction?.Invoke();
}
[ClientRpc]
public void MyClientRpc()
{
OnClientRpcAction?.Invoke();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fdfa28da9866545428083671c445a9ef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,50 @@
#if MULTIPLAYER_TOOLS
using Unity.Multiplayer.Tools.MetricTypes;
using Unity.Multiplayer.Tools.NetStats;
namespace Unity.Netcode.TestHelpers.Runtime.Metrics
{
internal class WaitForCounterMetricValue : WaitForMetricValues<Counter>
{
private long m_Value;
public delegate bool CounterFilter(long metric);
private CounterFilter m_CounterFilterDelegate;
public WaitForCounterMetricValue(IMetricDispatcher dispatcher, DirectionalMetricInfo directionalMetricName)
: base(dispatcher, directionalMetricName)
{
}
public WaitForCounterMetricValue(IMetricDispatcher dispatcher, DirectionalMetricInfo directionalMetricName, CounterFilter counterFilter)
: this(dispatcher, directionalMetricName)
{
m_CounterFilterDelegate = counterFilter;
}
public long AssertMetricValueHaveBeenFound()
{
AssertHasError();
AssertIsFound();
return m_Value;
}
public override void Observe(MetricCollection collection)
{
if (FindMetric(collection, out var metric))
{
var typedMetric = metric as Counter;
if (typedMetric == default)
{
SetError(metric);
return;
}
m_Value = typedMetric.Value;
m_Found = m_CounterFilterDelegate != null ? m_CounterFilterDelegate(m_Value) : true;
}
}
}
}
#endif

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: aa1d3026d48b43bfa4c76e253b08b3ae
timeCreated: 1644269156

View File

@@ -0,0 +1,60 @@
#if MULTIPLAYER_TOOLS
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using NUnit.Framework;
using Unity.Multiplayer.Tools.MetricTypes;
using Unity.Multiplayer.Tools.NetStats;
namespace Unity.Netcode.TestHelpers.Runtime.Metrics
{
internal class WaitForEventMetricValues<TMetric> : WaitForMetricValues<TMetric>
{
IReadOnlyCollection<TMetric> m_EventValues;
public delegate bool EventFilter(TMetric metric);
EventFilter m_EventFilterDelegate;
public WaitForEventMetricValues(IMetricDispatcher dispatcher, DirectionalMetricInfo directionalMetricName)
: base(dispatcher, directionalMetricName)
{
}
public WaitForEventMetricValues(IMetricDispatcher dispatcher, DirectionalMetricInfo directionalMetricName, EventFilter eventFilter)
: this(dispatcher, directionalMetricName)
{
m_EventFilterDelegate = eventFilter;
}
public IReadOnlyCollection<TMetric> AssertMetricValuesHaveBeenFound()
{
AssertHasError();
AssertIsFound();
return m_EventValues;
}
public override void Observe(MetricCollection collection)
{
if (FindMetric(collection, out var metric))
{
var typedMetric = metric as IEventMetric<TMetric>;
if (typedMetric == default)
{
SetError(metric);
return;
}
if (typedMetric.Values.Any())
{
// Apply filter if one was provided
m_EventValues = m_EventFilterDelegate != null ? typedMetric.Values.Where(x => m_EventFilterDelegate(x)).ToList() : typedMetric.Values.ToList();
m_Found = m_EventValues.Count > 0;
}
}
}
}
}
#endif

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 319c55f92728431283c9e888d8f9d70e
timeCreated: 1644269156

View File

@@ -0,0 +1,55 @@
#if MULTIPLAYER_TOOLS
using Unity.Multiplayer.Tools.MetricTypes;
using Unity.Multiplayer.Tools.NetStats;
namespace Unity.Netcode.TestHelpers.Runtime.Metrics
{
internal class WaitForGaugeMetricValues : WaitForMetricValues<Gauge>
{
private double m_Value;
public delegate bool GaugeFilter(double metric);
private GaugeFilter m_GaugeFilterDelegate;
public WaitForGaugeMetricValues(IMetricDispatcher dispatcher, DirectionalMetricInfo directionalMetricName)
: base(dispatcher, directionalMetricName)
{
}
public WaitForGaugeMetricValues(IMetricDispatcher dispatcher, DirectionalMetricInfo directionalMetricName, GaugeFilter counterFilter)
: this(dispatcher, directionalMetricName)
{
m_GaugeFilterDelegate = counterFilter;
}
public bool MetricFound()
{
return m_Found;
}
public double AssertMetricValueHaveBeenFound()
{
AssertHasError();
AssertIsFound();
return m_Value;
}
public override void Observe(MetricCollection collection)
{
if (FindMetric(collection, out var metric))
{
var typedMetric = metric as Gauge;
if (typedMetric == default)
{
SetError(metric);
return;
}
m_Value = typedMetric.Value;
m_Found = m_GaugeFilterDelegate != null ? m_GaugeFilterDelegate(m_Value) : true;
}
}
}
}
#endif

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1d76c4e546c546a3b9d63b2c74fcbbca
timeCreated: 1644269156

View File

@@ -0,0 +1,100 @@
#if MULTIPLAYER_TOOLS
using System.Collections;
using System.Linq;
using NUnit.Framework;
using Unity.Multiplayer.Tools.MetricTypes;
using Unity.Multiplayer.Tools.NetStats;
namespace Unity.Netcode.TestHelpers.Runtime.Metrics
{
internal abstract class WaitForMetricValues<TMetric> : IMetricObserver
{
protected readonly string m_MetricName;
protected bool m_Found;
protected bool m_HasError;
protected string m_Error;
protected uint m_NbFrames = 0;
public WaitForMetricValues(IMetricDispatcher dispatcher, DirectionalMetricInfo directionalMetricName)
{
m_MetricName = directionalMetricName.Id;
dispatcher.RegisterObserver(this);
}
abstract public void Observe(MetricCollection collection);
public void AssertMetricValuesHaveNotBeenFound()
{
if (m_HasError)
{
Assert.Fail(m_Error);
}
if (!m_Found)
{
Assert.Pass();
}
else
{
Assert.Fail();
}
}
public IEnumerator WaitForMetricsReceived()
{
yield return WaitForFrames(60);
}
protected void AssertHasError()
{
if (m_HasError)
{
Assert.Fail(m_Error);
}
}
protected void AssertIsFound()
{
if (!m_Found)
{
Assert.Fail($"Found no matching values for metric of type '{typeof(TMetric).Name}', with name '{m_MetricName}' during '{m_NbFrames}' frames.");
}
}
protected bool FindMetric(MetricCollection collection, out IMetric metric)
{
if (m_Found || m_HasError)
{
metric = null;
return false;
}
metric = collection.Metrics.SingleOrDefault(x => x.Name == m_MetricName);
if (metric == default)
{
m_HasError = true;
m_Error = $"Metric collection does not contain metric named '{m_MetricName}'.";
return false;
}
return true;
}
protected void SetError(IMetric metric)
{
m_HasError = true;
m_Error = $"Metric collection contains a metric of type '{metric.GetType().Name}' for name '{m_MetricName}', but was expecting '{typeof(TMetric).Name}'.";
}
private IEnumerator WaitForFrames(uint maxNbFrames)
{
while (!m_Found && m_NbFrames < maxNbFrames)
{
m_NbFrames++;
yield return null;
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 176888f06e2c5e14db33783fd0299668
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: