fix: Fixed an issue where BatchedSendQueue was including the HeadIndex twice when copying data, which was causing stream corruption when the data exceeded a certain throughput. [NCCBUG-187] (#2332)
* refactor
MTT-4462
Renaming shouldGhostsInterpolate to teleportDisabled for better clarity of what that parameter does. While renaming it to isTeleporting would make more sense, that could potentially become a breaking change, and so the next best parameter name would be "teleportDisabled" which would not break users that use this parameter currently.
* fix
This prevents the issue (when just destroying the GameObject) where any NetworkBehaviour component(s) destroyed before the NetworkObject would not have OnNetworkDespawn invoked.
* test
Adding the test to validate this fix.
* fix
MTT-4681
this fix assures that IsSpawnedObjectsPendingInDontDestroyOnLoad is only set to true when LoadSceneMode = LoadSceneMode.Singleonly.
* update
updating changelog.
* update
Adding the 2023.1.a21 FindObjectsByType fix for NGO using the UNITY_2023_1_OR_NEWER define.
Modified a few of the FindObjectsSortMode for areas that looked like they might require their results ordered by InstanceID.
* better error handling.
Adding IsNullOrEmpty checks
Removing catching of the exception. With previous version, NGO still starts and IsClient is still set. With exception, StartHost fails now correctly when certificates are not set.
* adding const strings for relay connection types (instead of having to guess)
* adding test for null check
* Address review comments
Co-authored-by: Simon Lemay <simon.lemay@unity3d.com>
* feat
This includes the changes to provide users with a way to synchronize NetworkBehaviours with custom data prior to their associated NetworkObject is spawned.
* fix and refactor
This updates NetworkTransform so that it will properly synchronize when placed on nested NetworkBehaviours (i.e. their GameObject has no NetworkObject component).
This also includes some fixes that allows for NetworkObjects to fail, NetworkVariables to fail, and NetworkBehaviour synchronization to fail without impacting the rest of the synchronization process.
Minor fix for in-scene placed parenting under a non-NetworkObject to prevent from being added to the orphaned child list.
* test
Renamed NetworkObjectSceneSerializationTests to NetworkObjectSynchronizationTests.
Added a more robust/wider range of tests, also added running host or server as well as added a basic OnSynchronize test.
Added integration test to validate nested network transforms synchronize properly with nested GameObjects' transforms.
Fixed an issue with late joined clients not registering all players in NetcodeIntegrationTest.
* test manual
This include a nested NetworkTransform manual test to visually validate the nested NetworkTransform update.
Adds support for SDKs at different versions with different message formats to be able to talk to each other - the side with the higher version being responsible for both converting up when receiving and converting down when sending.
fix: not using NativeArrayExtensions.IndexOf as this API changed in 2.1.0-pre.2
Co-authored-by: ashwini <36935028+ashwinimurt@users.noreply.github.com>
Co-authored-by: Fatih Mar <mfatihmar@gmail.com>
Adds byte packing for most integer fields in the SDK (a few, such as hashes, are left un-packed because they're likely to be large integers and not benefit - and may possibly actually be harmed - by variable-length encoding). Integers in `RPC`s and `NetworkVariable`s are also packed properly. No functionality has been added to allow a value to be sent unpacked in `RPC`s or `NetworkVariable`s in cases where packing may be detrimental, but this can be achieved as follows:
```csharp
public struct UnpackedInt32 : INetworkSerializeByMemcpy
{
int Value;
}
public NetworkVariable<UnpackedInt32> MyVariable;
````
In addition to byte packing most integer fields, this commit updates `WriteValueBitPacked()` to be able to handle the full range of its type (now using an extra byte - and thus ending up making the representation larger instead of smaller - for values at the extreme ends of the size), at the cost of using one extra bit to encode the size of the type.
* fix
Exclude the host-client from being processed as one of the clients to test for when the scene event has completed.
GetClientsWithStatus needed to add the host-client to the list of clients that completed once the scene event was completed. Also fixed a bug in GetClientsWithStatus where, when checking for clients that did not complete, it would include the clients that completed and the clients that did not complete in the list of client identifiers it returned.
Fixing issue where integration tests could lag by more than 1 network tick and the AsyncOperation could not yet be assigned.
* test
Added HostReceivesOneLoadEventCompletedNotification integration test to validate the fix for this PR.
Updated NetcodeIntegrationTest virtual methods to be able to gain access to a newly created client (via NetcodeIntegrationTest.CreateAndStartNewClient) when it is first created, started, and when it has been connected.
The updates to SceneEventProgress exposed an issue with ClientSynchronizationValidationTest. It was written before many NetcodeIntegrationTest helpers, so there are adjustments here to leverage from those which greatly simplifies the test.
Switched the scene that was not validated by the client-side to one that did not contain an in-scene placed NetworkObject.
Co-authored-by: Unity Netcode CI <74025435+netcode-ci-service@users.noreply.github.com>
* update
Migrated the multiplayer tools install reminder over to the new Netcode for GameObjects settings.
Deleted the UITestHelpers class completely as it is no longer needed.
* fix
This resolves the issue where NetworkObjects were not taking Auto Object Parent Sync into consideration.
* test
The test to validate that nested in-scene placed NetworkObjects that both have Auto Object Parent Synchronization enabled and disabled synchronize their transforms properly on the client side. The same test covers NetworkObjects nested under GameObjects with no NetworkObject components. All nested instances have varying position, rotation, and scale values.
* fix
Migrate InvokeOnClientConnectedCallback into StartHost (for host only).
* test
Updating the NetworkManagerTests to validate this PR, it also validates that this update does not impact anything when scene management is disabled.
* fix
This fix separates the IsConnectedClient from the approval process by adding an IsApproved flag.
This also has a fix to prevent the domain backup error during serialization.
* test
Added the ability to bypass the entire NetcodeIntegrationTest connection approval process after the server and clients have been started. This allows us to now use NetcodeIntegrationTest for unique connection oriented tests without being bound to the asserts if not all clients connected properly.
Refactored for ConnectionApprovalTimeoutTests to use the added m_BypassConnectionTimeout to bypass the waiting for clients to connect. It still uses the message hook catch technique to simulate the timeout scenarios where either a server detects a transport connection but never receives a connection request or a client sends the connection request but never receives approval for the connection.
* fix
This resolves the issue where SceneEventProgress was not checking if the NetworkManager was no longer listening or a shutdown was in progress.
* update
Added additional NetworkLog warning when a client times out during connection approval.
* test
Added a mock test to verify SceneEventProgress can handle the NetworkManager shutting down during a scene event.
* fix
Fixes issue where despawning a parent NetworkObject would try to remove itself from the child on the client-side.
* test
Adding a test to verify this fix
* fix: Refactored DeferredMessagingTests to not use coroutines and increased the slush value for the two timing-based tests... hopefully this will clear up the instability
* standards
* fixed failing tests
* Removed some commented-out code and left-in debug code.
* fix
This resolves the issue with in-scene placed NetworkObjects that are disabled when despawned not being able to re-spawn again and handles synchronizing despawned in-scene placed NetworkObjects during a scene switch (LoadSceneMode.Single).
* test
Added integration test that validates disabling NetworkObjects when despawned works with currently connected clients, late joining clients, and when scene switching (LoadSceneMode.Single) while also having the server despawn the in-scene placed NetworkObject upon its first spawn (i.e. so it starts off not visible/active to the clients when they finish the scene switch).