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

@@ -10,7 +10,7 @@ namespace Unity.Netcode
public static class BytePacker
{
#if UNITY_NETCODE_DEBUG_NO_PACKING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void WriteValuePacked<T>(FastBufferWriter writer, T value) where T: unmanaged => writer.WriteValueSafe(value);
#else
@@ -277,10 +277,21 @@ namespace Unity.Netcode
#if UNITY_NETCODE_DEBUG_NO_PACKING
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void WriteValueBitPacked<T>(FastBufferWriter writer, T value) where T: unmanaged => writer.WriteValueSafe(value);
#else
public const ushort BitPackedUshortMax = (1 << 15) - 1;
public const short BitPackedShortMax = (1 << 14) - 1;
public const short BitPackedShortMin = -(1 << 14);
public const uint BitPackedUintMax = (1 << 30) - 1;
public const int BitPackedIntMax = (1 << 29) - 1;
public const int BitPackedIntMin = -(1 << 29);
public const ulong BitPackedULongMax = (1L << 61) - 1;
public const long BitPackedLongMax = (1L << 60) - 1;
public const long BitPackedLongMin = -(1L << 60);
/// <summary>
/// Writes a 14-bit signed short to the buffer in a bit-encoded packed format.
/// The first bit indicates whether the value is 1 byte or 2.
@@ -307,7 +318,7 @@ namespace Unity.Netcode
public static void WriteValueBitPacked(FastBufferWriter writer, ushort value)
{
#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (value >= 0b1000_0000_0000_0000)
if (value >= BitPackedUshortMax)
{
throw new ArgumentException("BitPacked ushorts must be <= 15 bits");
}
@@ -356,7 +367,7 @@ namespace Unity.Netcode
public static void WriteValueBitPacked(FastBufferWriter writer, uint value)
{
#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (value >= 0b0100_0000_0000_0000_0000_0000_0000_0000)
if (value > BitPackedUintMax)
{
throw new ArgumentException("BitPacked uints must be <= 30 bits");
}
@@ -396,7 +407,7 @@ namespace Unity.Netcode
public static void WriteValueBitPacked(FastBufferWriter writer, ulong value)
{
#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (value >= 0b0010_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000)
if (value > BitPackedULongMax)
{
throw new ArgumentException("BitPacked ulongs must be <= 61 bits");
}

View File

@@ -19,7 +19,7 @@ namespace Unity.Netcode
#endif
}
internal readonly unsafe ReaderHandle* Handle;
internal unsafe ReaderHandle* Handle;
/// <summary>
/// Get the current read position
@@ -39,6 +39,11 @@ namespace Unity.Netcode
get => Handle->Length;
}
/// <summary>
/// Gets a value indicating whether the reader has been initialized and a handle allocated.
/// </summary>
public unsafe bool IsInitialized => Handle != null;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal unsafe void CommitBitwiseReads(int amount)
{
@@ -196,6 +201,7 @@ namespace Unity.Netcode
public unsafe void Dispose()
{
UnsafeUtility.Free(Handle, Handle->Allocator);
Handle = null;
}
/// <summary>

View File

@@ -22,7 +22,7 @@ namespace Unity.Netcode
#endif
}
internal readonly unsafe WriterHandle* Handle;
internal unsafe WriterHandle* Handle;
private static byte[] s_ByteArrayCache = new byte[65535];
@@ -62,6 +62,11 @@ namespace Unity.Netcode
get => Handle->Position > Handle->Length ? Handle->Position : Handle->Length;
}
/// <summary>
/// Gets a value indicating whether the writer has been initialized and a handle allocated.
/// </summary>
public unsafe bool IsInitialized => Handle != null;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal unsafe void CommitBitwiseWrites(int amount)
@@ -111,6 +116,7 @@ namespace Unity.Netcode
UnsafeUtility.Free(Handle->BufferPointer, Handle->Allocator);
}
UnsafeUtility.Free(Handle, Handle->Allocator);
Handle = null;
}
/// <summary>
@@ -207,7 +213,7 @@ namespace Unity.Netcode
/// When you know you will be writing multiple fields back-to-back and you know the total size,
/// you can call TryBeginWrite() once on the total size, and then follow it with calls to
/// WriteValue() instead of WriteValueSafe() for faster serialization.
///
///
/// Unsafe write operations will throw OverflowException in editor and development builds if you
/// go past the point you've marked using TryBeginWrite(). In release builds, OverflowException will not be thrown
/// for performance reasons, since the point of using TryBeginWrite is to avoid bounds checking in the following
@@ -253,7 +259,7 @@ namespace Unity.Netcode
/// When you know you will be writing multiple fields back-to-back and you know the total size,
/// you can call TryBeginWrite() once on the total size, and then follow it with calls to
/// WriteValue() instead of WriteValueSafe() for faster serialization.
///
///
/// Unsafe write operations will throw OverflowException in editor and development builds if you
/// go past the point you've marked using TryBeginWrite(). In release builds, OverflowException will not be thrown
/// for performance reasons, since the point of using TryBeginWrite is to avoid bounds checking in the following