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

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.7] - 2022-04-01

### Added

- Added editor only check prior to entering into play mode if the currently open and active scene is in the build list and if not displays a dialog box asking the user if they would like to automatically add it prior to entering into play mode. (#1828)
- Added `UnityTransport` implementation and `com.unity.transport` package dependency (#1823)
- Added `NetworkVariableWritePermission` to `NetworkVariableBase` and implemented `Owner` client writable netvars. (#1762)
- `UnityTransport` settings can now be set programmatically. (#1845)
- `FastBufferWriter` and Reader IsInitialized property. (#1859)

### Changed

- Updated `UnityTransport` dependency on `com.unity.transport` to 1.0.0 (#1849)

### Removed

- Removed `SnapshotSystem` (#1852)
- Removed `com.unity.modules.animation`, `com.unity.modules.physics` and `com.unity.modules.physics2d` dependencies from the package (#1812)
- Removed `com.unity.collections` dependency from the package (#1849)

### Fixed
- Fixed in-scene placed NetworkObjects not being found/ignored after a client disconnects and then reconnects. (#1850)
- Fixed issue where `UnityTransport` send queues were not flushed when calling `DisconnectLocalClient` or `DisconnectRemoteClient`. (#1847)
- Fixed NetworkBehaviour dependency verification check for an existing NetworkObject not searching from root parent transform relative GameObject. (#1841)
- Fixed issue where entries were not being removed from the NetworkSpawnManager.OwnershipToObjectsTable. (#1838)
- Fixed ClientRpcs would always send to all connected clients by default as opposed to only sending to the NetworkObject's Observers list by default. (#1836)
- Fixed clarity for NetworkSceneManager client side notification when it receives a scene hash value that does not exist in its local hash table. (#1828)
- Fixed client throws a key not found exception when it times out using UNet or UTP. (#1821)
- Fixed network variable updates are no longer limited to 32,768 bytes when NetworkConfig.EnsureNetworkVariableLengthSafety is enabled. The limits are now determined by what the transport can send in a message. (#1811)
- Fixed in-scene NetworkObjects get destroyed if a client fails to connect and shuts down the NetworkManager. (#1809)
- Fixed user never being notified in the editor that a NetworkBehaviour requires a NetworkObject to function properly. (#1808)
- Fixed PlayerObjects and dynamically spawned NetworkObjects not being added to the NetworkClient's OwnedObjects (#1801)
- Fixed issue where NetworkManager would continue starting even if the NetworkTransport selected failed. (#1780)
- Fixed issue when spawning new player if an already existing player exists it does not remove IsPlayer from the previous player (#1779)
- Fixed lack of notification that NetworkManager and NetworkObject cannot be added to the same GameObject with in-editor notifications (#1777)
- Fixed parenting warning printing for false positives (#1855)
This commit is contained in:
Unity Technologies
2022-04-01 00:00:00 +00:00
parent 5b4aaa8b59
commit 60e2dabef4
123 changed files with 5751 additions and 3419 deletions

View File

@@ -5,6 +5,7 @@ using System.Linq;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
using System.Runtime.CompilerServices;
using Object = UnityEngine.Object;
@@ -111,6 +112,33 @@ namespace Unity.Netcode.TestHelpers.Runtime
private NetworkManagerInstatiationMode m_NetworkManagerInstatiationMode;
private bool m_EnableVerboseDebug;
/// <summary>
/// Used to display the various integration test
/// stages and can be used to log verbose information
/// for troubleshooting an integration test.
/// </summary>
/// <param name="msg"></param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected void VerboseDebug(string msg)
{
if (m_EnableVerboseDebug)
{
Debug.Log(msg);
}
}
/// <summary>
/// Override this and return true if you need
/// to troubleshoot a hard to track bug within an
/// integration test.
/// </summary>
protected virtual bool OnSetVerboseDebug()
{
return false;
}
/// <summary>
/// The very first thing invoked during the <see cref="OneTimeSetup"/> that
/// determines how this integration test handles NetworkManager instantiation
@@ -130,11 +158,17 @@ namespace Unity.Netcode.TestHelpers.Runtime
[OneTimeSetUp]
public void OneTimeSetup()
{
m_EnableVerboseDebug = OnSetVerboseDebug();
VerboseDebug($"Entering {nameof(OneTimeSetup)}");
m_NetworkManagerInstatiationMode = OnSetIntegrationTestMode();
// Enable NetcodeIntegrationTest auto-label feature
NetcodeIntegrationTestHelpers.RegisterNetcodeIntegrationTest(true);
OnOneTimeSetup();
VerboseDebug($"Exiting {nameof(OneTimeSetup)}");
}
/// <summary>
@@ -153,6 +187,8 @@ namespace Unity.Netcode.TestHelpers.Runtime
[UnitySetUp]
public IEnumerator SetUp()
{
VerboseDebug($"Entering {nameof(SetUp)}");
yield return OnSetup();
if (m_NetworkManagerInstatiationMode == NetworkManagerInstatiationMode.AllTests && m_ServerNetworkManager == null ||
m_NetworkManagerInstatiationMode == NetworkManagerInstatiationMode.PerTest)
@@ -161,6 +197,7 @@ namespace Unity.Netcode.TestHelpers.Runtime
yield return StartServerAndClients();
}
VerboseDebug($"Exiting {nameof(SetUp)}");
}
/// <summary>
@@ -173,6 +210,7 @@ namespace Unity.Netcode.TestHelpers.Runtime
private void CreatePlayerPrefab()
{
VerboseDebug($"Entering {nameof(CreatePlayerPrefab)}");
// Create playerPrefab
m_PlayerPrefab = new GameObject("Player");
NetworkObject networkObject = m_PlayerPrefab.AddComponent<NetworkObject>();
@@ -181,6 +219,8 @@ namespace Unity.Netcode.TestHelpers.Runtime
NetcodeIntegrationTestHelpers.MakeNetworkObjectTestPrefab(networkObject);
OnCreatePlayerPrefab();
VerboseDebug($"Exiting {nameof(CreatePlayerPrefab)}");
}
/// <summary>
@@ -207,6 +247,8 @@ namespace Unity.Netcode.TestHelpers.Runtime
/// <param name="numberOfClients"></param>
protected void CreateServerAndClients(int numberOfClients)
{
VerboseDebug($"Entering {nameof(CreateServerAndClients)}");
CreatePlayerPrefab();
// Create multiple NetworkManager instances
@@ -235,6 +277,8 @@ namespace Unity.Netcode.TestHelpers.Runtime
// Provides opportunity to allow child derived classes to
// modify the NetworkManager's configuration before starting.
OnServerAndClientsCreated();
VerboseDebug($"Exiting {nameof(CreateServerAndClients)}");
}
/// <summary>
@@ -272,6 +316,8 @@ namespace Unity.Netcode.TestHelpers.Runtime
{
if (CanStartServerAndClients())
{
VerboseDebug($"Entering {nameof(StartServerAndClients)}");
// Start the instances and pass in our SceneManagerInitialization action that is invoked immediately after host-server
// is started and after each client is started.
if (!NetcodeIntegrationTestHelpers.Start(m_UseHost, m_ServerNetworkManager, m_ClientNetworkManagers))
@@ -290,11 +336,6 @@ namespace Unity.Netcode.TestHelpers.Runtime
Assert.False(s_GlobalTimeoutHelper.TimedOut, $"{nameof(StartServerAndClients)} timed out waiting for all clients to be connected!");
if (s_GlobalTimeoutHelper.TimedOut)
{
yield return null;
}
if (m_UseHost || m_ServerNetworkManager.IsHost)
{
// Add the server player instance to all m_ClientSidePlayerNetworkObjects entries
@@ -332,6 +373,8 @@ namespace Unity.Netcode.TestHelpers.Runtime
// Notification that at this time the server and client(s) are instantiated,
// started, and connected on both sides.
yield return OnServerAndClientsConnected();
VerboseDebug($"Exiting {nameof(StartServerAndClients)}");
}
}
@@ -398,6 +441,7 @@ namespace Unity.Netcode.TestHelpers.Runtime
/// </summary>
protected void ShutdownAndCleanUp()
{
VerboseDebug($"Entering {nameof(ShutdownAndCleanUp)}");
// Shutdown and clean up both of our NetworkManager instances
try
{
@@ -427,6 +471,7 @@ namespace Unity.Netcode.TestHelpers.Runtime
// reset the m_ServerWaitForTick for the next test to initialize
s_DefaultWaitForTick = new WaitForSeconds(1.0f / k_DefaultTickRate);
VerboseDebug($"Exiting {nameof(ShutdownAndCleanUp)}");
}
/// <summary>
@@ -441,12 +486,15 @@ namespace Unity.Netcode.TestHelpers.Runtime
[UnityTearDown]
public IEnumerator TearDown()
{
VerboseDebug($"Entering {nameof(TearDown)}");
yield return OnTearDown();
if (m_NetworkManagerInstatiationMode == NetworkManagerInstatiationMode.PerTest)
{
ShutdownAndCleanUp();
}
VerboseDebug($"Exiting {nameof(TearDown)}");
}
/// <summary>
@@ -462,6 +510,7 @@ namespace Unity.Netcode.TestHelpers.Runtime
[OneTimeTearDown]
public void OneTimeTearDown()
{
VerboseDebug($"Entering {nameof(OneTimeTearDown)}");
OnOneTimeTearDown();
if (m_NetworkManagerInstatiationMode == NetworkManagerInstatiationMode.AllTests)
@@ -471,6 +520,8 @@ namespace Unity.Netcode.TestHelpers.Runtime
// Disable NetcodeIntegrationTest auto-label feature
NetcodeIntegrationTestHelpers.RegisterNetcodeIntegrationTest(false);
VerboseDebug($"Exiting {nameof(OneTimeTearDown)}");
}
/// <summary>