* fix
This fixes the issue where the currently active scene, on the server side, is not taken into consideration as being a valid "loaded scene" which can cause issues as outlined in GitHub issue #2722.
* fix: TestHelpers
This resolves an issue with integration testing where:
- the scene handler registration was being registered multiple times
- the server registration was not passing in true to NetcodeIntegrationTestHelper.RegisterHandlers
- the IntegrationTestSceneHandler.CoroutineRunner could get destroyed if the active scene it was instantiated within was unloaded (now it is migrated to the DDOL)
- Registration of the currently active scene during the scene handler registration was adjusted to no longer use NetworkSceneManager.GetAndAddNewlyLoadedSceneByName (but still registers the scene).
* test
Added an integration test: `NetworkSceneManagerFixValidationTests.InitialActiveSceneUnload`
This validates the fix for #2722.
* update
Adding change log entry for this fix.
Adds support for generic network behaviours, as well as for serializing generic types in RPCs (so long as the type is defined on the behaviour and not on the RPC itself; which is to say, this is supported:
```csharp
public class Foo<T> : NetworkBehaviour
{
[ServerRpc]
public void MyServerRpc(T val) {}
}
```
But this is not:
```csharp
public class Foo : NetworkBehaviour
{
[ServerRpc]
public void MyServerRpc<T>(T val) {}
}
```
As in the former case, when the class is instantiated, it knows what T is and there is only one version of the RPC per class, while the latter case would require much more significant plumbing for runtime type identification of RPC parameters in order to be able to instantiate the RPC correctly on the receiving side.)
In fixing this, the majority of the issues with domain reload were also fixed coincidentally, so I went ahead and fixed the couple of remaining issues as well.
* update
Removing the invocation of process scene from the OnValidate.
* update
Just merging GenerateGlobalObjectIdHash into OnValidate (no reason to have the method call a method).
* update
Adding OnOwnershipChanged(ulong previous, ulong current)
* fix
This resolves the issue with client authoritative network transforms and the random "noise" that would occur when transitioning ownership from a remote client back to the host-server.
- Latent messages from the client would still be received and processed after ownership changed.
- Ownership changed messages would proceed the NetworkTransform initialization state update message. Now ownership changed messages precede the NetworkTransform initialization state update message.
- Clients could sometimes have the same network tick value even when the tick event had triggered, which for NetworkDeltaPosition would cause dropped state updates.
This enables users to control the generation of serialization code through codegen, making it easier to create their own network variable subtypes, and also making it possible for them to easily generate serialization for specific types they know they need to use. NetworkVariable and NetworkList have been changed to use these attributes so they are no longer special cases in our codegen.
This PR also exposes methods in `NetworkVariableSerialization<T>` to further support this type of serialization need.
resolves#2686
---------
Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
* update
Resolves MTT-7055.
Split apart the NetworkObjectRefreshTool from NetworkObject.
Made some updates that don't require any form of editor application update.
Added script in NetworkObject.RefreshAllPrefabInstances context menu method that handles refreshing the currently active scene and all enabled scenes in the build list.
Added dialog notification when attempting to do a NetworkObject Refresh on an in-scene placed prefab instance as opposed to a prefab instance.
* test
Made some minor updates for the manual test
* update
adding change log entry
* style
Added object type identifier constants for code clarity purposes.
* fix
MTT-7216
This resolves the issue where an in-scene placed NetworkObject can have NetworkBehaviour components not invoke the OnNetworkDespawn method when doing a full scene transition (LoadSceneMode.Single) due to the way GameObjects destroy the attached components.
* test
This is a unit test to validate the re-ordering of the NetworkObject component.
* fix
MTT-7237
Include the SpawnWithObservers check when scene management is disabled.
* test
Extending the ObserverSpawnTests to run a pass with scene management disabled.
* update
Adding change log entry.
* fix
This fixes an issue where ConnectionModeScript and/or StatsDisplay would throw an exception if certain optional properties were not defined.
* update
Minor adjustment to the Spawner class where if the frequency of spawning is set to zero it will only spawn 1 instance (i.e. a one shot spawner).
Updated several samples to use UnityTransport as opposed to UNet.
Limited number of objects spawned, adjusted the ray cast line renderer, updated the physics player to have a ray pointing towards its forward (to know the direction you are going) in physics example.
Adjusted the connect mode buttons so they will automatically re-appear when you disconnect.
Updated several projects to have their own network prefab list.
* fix
So far this user suggested fix looks promising. Creating a prefab from within a scene no longer requires one to delete the original (in-scene) object and then create a new instance from the newly created prefab. It also is automatically detected and added to the default prefabs.
Fixing issue with namespace being outside of the UNIT_EDITOR conditional and removed an unused private property.
Fixing issue with PrefabStageUtility not existing in the same namespace based on Unity editor version.
Make sure the default network prefabs list is generated automatically by default.
* update
Minor rename of a variable.
Updated comments for further clarification as to what is happening.
* test
Adding method to expose GlobalObjectIdHash for manual testing purposes.
Attempting to fix the issue with TransformInterpolationTests stability.
Really, this test should be re-written.
* fix
This resolves the issue with clients not keep track of changes to the layer weights.
* test
Validates the fix to assure clients receive weight updates and track them in order to be able to apply changes when needed.
* fix
Word alignment applied to batch message.
Adjusted MaximumTransmissionUnitSize setter to round down to nearest word aligned size
Adjusted DefaultNonFragmentedMessageMaxSize to round down to nearest word aligned size
* Fixed tests
The tools bytes measured tests were slightly modified
---------
Co-authored-by: Kitty Draper <kitty.draper@unity3d.com>
* fix
This resolves an issue with half float precision not synchronizing properly when running in owner authoritative mode, the owner client sends an update to the host-server, the host-server then forwards the state update to the remaining clients at the end of the frame but during the initial processing of the state update the delta position value is collapsed into the full float position due to exceeding the maximum delta. The primary issue was the order of operations that occurred using NetworkVariables to update the transform state when in owner authority mode.
This also reduces the amount of serialization and processing a host has to perform when receiving owner authoritative updates and there are 2 or more remote clients connected (i.e. it has to forward the result to the other clients). Now, it just forwards the message payload to the non-owner clients upon receiving the state update.
This also fixes:
- an on-going issue with scale where really the answer was to send both the lossy and local scale values when synchronizing and/or teleporting and letting the client-side determine which to use depending upon whether the NetworkObject was parented, was the parenting applied when applying the states, and whether the parenting used WorldPositionStays.
- some minor issues with the parenting test not checking if the NetworkObject was parented before testing the final values.
- updates named message handling slightly so it doesn't spam the log console during shutdown if there are incoming messages while shutting down.
- resolves an issue where you have an owner authoritative NetworkTransform and a host-server with two remote clients connected and the following sequence occurs:
- Client A connects to the host first and takes ownership of a NetworkObject but does not change the transform state.
- Client B connects and attempts to move the NetworkObject that Client A owns
- Client B was able to move the NetworkObject
* test
Adding NetworkTransformStateFlags test to validate the NetworkTransformState flags.
Adding internal BitSet setter and getter for testing and a BitSet flag test.
This test adds a "sub-child" (NetworkObject parented under a child) to the parenting test to add the additional check and make sure that all nested children preserve their values when changed for connected clients and those changes are applied and preserved for late joining clients.
Adding a test to verify that when a late joining client is connected after ownership has been transferred from the host-server to an already connected client and the owner authoritative transform has not changed yet that the non-owner client cannot change the transform values.
* fix
This fixes an issue where CheckForNetworkObject would perform its check when in playmode. This only needs to perform the check when not in play mode.
* style
Updated comments to be a bit clearer on what was updated.
* update
excluding getTypeName,
* update
Make sure internal classes can access NetworkBehaviour.NetworkVariableFields in runtime builds.
* update
to get RPCS working temporarily.
* style
Adding comments about the RPC stuff since it is a bit more complicated than the previous two issues.
* style
updating and adding comments to regions of code changed in order to easily distinguish the changes made for each issue type.
* update
Missed two files.
* Updated the ILPP code to work correctly with CoreCLR:
- delegates are no longer fields, but types
- internal virtual functions can't be overridden in child classes anymore, so they have to be changed from `IsAssembly` to `IsFamilyOrAssembly` in ILPP
- Internal fields changed to `IsFamily` can no longer be accessed within the assembly, and need to be `IsFamilyOrAssembly` instead.
With those changes, previous workarounds are no longer needed, so I reverted them.
* update
removing commented out code.
wrapping the rpc table generation log info so it only logs to the console when log mode is set to developer.
* style
Fixing whitespace issue.
* revert __RpcParams to internal
* update
adding change log entry
* update
Moving the version number back down to v1.5.1
* Fixed validator failures.
* Update package.json
Reverting back to v1.5.2 to validate compatibility testing
* Add Validation exceptions for 1.5.2
* Apparently the meta file is also needed.
---------
Co-authored-by: Kitty Draper <kitty.draper@unity3d.com>
* fix
This fixes the issue with NetworkClient.OwnedObjects always returning a zero count.
* style
removing TODO 2023-Q2 comments
* test
This validates the fixes for the owned objects list.
* update
removing an unrequired change.
* update
Adding the change log entry for this PR.
* test fix
Only test host for spawned objects locally, ignore that one portion when testing server only pass.
* fix: compile error with generic NetworkBehaviour singletons
* changelog
* Added another fix for a similar issue.
---------
Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
* fix
This resolves a few ownership related issues specifically noticed when using an owner authoritative NetworkTransform and ownership is removed.
This also assures NetworkVariables will be updated if ownership is removed just like they are when ownership is changed.
This also fixes an issue where NetworkManager's ShutdownInProgress was not true upon the application quitting which was causing an exception to occur within NetworkVariableBase under specific conditions.
* test
Removing a warning expect check that is no longer needed.
Adding additional checks to validate RemoveOwnership generates an OnOwnershipChanged notification.
* fix
This fixes the issue where full precision transform synchronization was losing state while interpolating.
* update
initial change log entry
* update
Adding PR number to change log entry
* fix
Missed including half float precision scale with interpolation enabled since scale only updates the axis that changed (i.e. a target axis value could get stomped otherwise when half precision was enabled...the coming test discovered this).
* test
Modified NetworkTransformMultipleChangesOverTime to use interpolation when 3 axis are being tested as well as added the additional logic required to catch the issue not caught by this test where a state update could stomp a single axial value if the target value had not yet been reached.
* fix
This fixes the issue with shutdown throwing an exception when being invoked again within the shutdown callback.
* test
Added test to validate the fix
* fix
This resolves the issue where NetworkObjects with SpawnWithObservers set to false was not being honored for late joining clients.
This also resolves an issue when scene management is disabled the NetworkObjects' observers were not being updated for newly connected clients.
* test
This validates the fix for the late joining client observer issue.
* fix
When connection approval is enabled and a client is not approved, the OnClientDisconnected callback handler was not being invoked.
(It was when a client terminates the connection but not when the server does)
* test
The test to validate the fix for the server-host not receiving the correct client identifier when denied approval for its pending connection.
Added additional functionality to NetcodeIntegrationTest that allows you to ignore waiting for a newly created client (i.e. not the default defined NumberOfClients) to connect.
Adding additional validation to assure we don't get multiple disconnect notifications on the server-host side when a client is disconnected.
* Update CHANGELOG.md
* style
renaming NetcodeIntegrationTest.WaitForNewClientToConnect to NetcodeIntegrationTest.ShouldWaitForNewClientToConnect
* fix
Providing a way for users to specify that a NetworkObject should not spawn with any observers without having to use CheckObjectVisbility as a "global" way to handle this as it conflicts with NetworkShow if the CheckObjectVisbility handler always returns false.
* test
Test that validates the changes.
* update
adding changelog entry.
* fix: Fixes warning logged on double-initialize of prefabs lists.
Also, makes adding prefabs before initializing the list no longer an error case - those prefabs are stored in a separate list so that during initialization, they can be re-added to the prefabs list after pulling in data from the NetworkPrefabsList ScriptableObjects.
* Changelog
* Update CHANGELOG.md
Re-ordering the changelog entries
---------
Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
* fix
Breaking apart the ValidateSceneBeforeLoading so synchronization can exclude runtime generated scenes.
* style
Added comment
* test
Test to validate the fix for the server being able to use NetworkSceneManager.VerifySceneBeforeLoading in order to exclude scenes created at runtime.
* update
Updating the changelog file to reflect the fix
* fix
This fixes an issue with interpolation causing nonauthoritative NetworkTransform instances to not properly reflect the final axis values when parenting changes.
* test
Updating the parenting test to validate the fix for parenting a nested NetworkTransform and assuring that values are the same.
* fix
Handle the condition that no new states have been pushed for a late joining client.
(i.e. it just synchronized a nested NetworkTransform and that is it)
* test
Did an overhaul on the parented NetworkTransformTest (formerly NetworkTransformParentedLocalSpaceTest), renamed it to ParentedNetworkTransformTest, and now it tests both world and local space values depending upon how the NetworkObject is parented.
* style
removing commented out code.
* update
Adding entry to changelog
* fix
Migrating SetStateInternal into the Initialization method so it handles change of ownership.
* fix
Change the order of operations where clients match the server's currently active scene and then spawn and synchronize NetworkObjects locally on the server.
Preprocess the scenes containing NetworkObjects to send scene migration notifications for in the event the NetworkObjects were despawned in the same frame.
* fix
Change the logic to detect if setting the synchronization mode is occurring when clients are already connected so that it is checking against whether it is a host vs server.
* Style
fixing white space issues.
* test
Added test to verify that late joining clients synchronize properly when a NetworkObject is migrated into a new scene and then despawn and destroyed during a late joining client's initial synchronization.
* update
Updating changelog
* fix: missing value on NetworkListEvent for EventType.RemoveAt events server side (#2542)
* Update CHANGELOG.md
* test
Updated the NetworkList remove tests to be combined into one test and to validate that the list changed event is returning the value of the element removed.
Cleaned up the tests a bit and removed some legacy tests that were being ignored and no longer serve a purpose.
---------
Co-authored-by: PitouGames <pitou.games@gmail.com>