Граф коммитов

2745 Коммитов

Автор SHA1 Сообщение Дата
Christopher Pope 212982cc5e
Update .buginfo 2023-10-25 13:31:34 +01:00
Kitty Draper b223d5f229
feat: expose NetworkObject.GetNetworkBehaviourAtOrderIndex (#2724) 2023-10-04 22:15:59 +00:00
Noel Stephens 1701474880
fix: Active scene not being added to server side NetworkSceneManager scenes loaded [MTT-7537] (#2723)
* 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.
2023-10-04 21:25:20 +00:00
Kitty Draper a60288fcc2
fix: Errors with NetworkVariable<float> and others in inspector (#2714)
Also fixes NetworkVariables with NonSerializedAttribute showing in editor when they should not.
2023-10-04 20:36:50 +00:00
Simon Lemay 6353f59014
feat: Log errors when Relay/WebSocket settings are mismatched (#2715)
Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
2023-10-04 17:50:06 +00:00
Simon Lemay b50b3960a2
feat: Update UTP to 1.4 and add ability to set UTP's MTU (#2716) 2023-10-04 15:44:58 +00:00
Kitty Draper d565d9de8a
feat: Support for generic NetworkBehaviour types, and fix: issues with domain reload/scene reload being disabled (#2720)
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.
2023-10-03 22:36:21 +00:00
Noel Stephens a5c01300b6
fix: GlobalObjectIdHash Generation (missed changes) (#2721)
* 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).
2023-10-03 13:20:39 -05:00
Noel Stephens aa7ecbfb5e
fix: ClientNetworkTransform ownership change with half precision synchronization issues [MTT-7271] (#2712)
* 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.
2023-10-03 11:25:00 -05:00
Kitty Draper 5a2b607da8
feat: Added `GenerateSerializationForGenericParameterAttribute` and `GenerateSerializationForTypeAttribute` (#2694)
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>
2023-10-02 21:07:18 +00:00
Noel Stephens c84a1dc40e
fix: GlobalObjectIdHash generation for already existing in-scene placed prefab instances [MTT-7055] (#2707)
* 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.
2023-10-02 14:41:35 -05:00
Simon Lemay ca577a6d3b
fix: Allow UDP/DTLS connections when working in the editor with WebGL (#2695)
* fix: Allow UDP/DTLS connections when working in the editor with WebGL

* Add PR number to CHANGELOG entry
2023-09-07 21:08:23 +00:00
Noel Stephens f59f5e60fa
fix: NetworkObject component should always precede NetworkBehaviour components [MTT-7216] (#2685)
* 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.
2023-08-30 15:25:17 -05:00
Kitty Draper a98170313f
feat: per-peer MTU (#2676) 2023-08-30 19:10:52 +00:00
Noel Stephens f890d7e194
fix: SpawnWithObservers not honored when EnableSceneManagement is disabled [MTT-7237] (#2682)
* 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.
2023-08-30 12:46:08 -05:00
Sam Bellomo 47f9d65683
chore: release/1.6.0 merge back to develop (#2684) 2023-08-30 09:26:12 +01:00
Noel Stephens dd015bf43b
chore: test project updates 2023-Q3 (#2679)
* 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.
2023-08-28 13:43:16 -05:00
Noel Stephens d3791985f0
fix: GlobalObjectidHash serializing invalid values [MTT-77098] (#2662)
* 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.
2023-08-25 19:37:19 +00:00
Noel Stephens b5b8edae4a
fix: client not tracking changes to layer weights [MTT-7166] (#2674)
* 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.
2023-08-23 23:50:49 +00:00
Kitty Draper cea44869ba
fix: Fixes "writing past the end of the buffer" error when calling ResetDirty() on managed network variables that are larger than 256 bytes when serialized. (#2670) 2023-08-22 16:56:13 -05:00
Noel Stephens cbc2d72189
fix: 32bit-ARMv7 crashes on android (#2654)
* 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>
2023-08-08 16:11:46 -05:00
Kitty Draper 7ae8296e96
fix: more CoreCLR ILPP fixes (#2656) 2023-08-07 15:37:17 -05:00
Noel Stephens 81fd4ef9d8
chore: merging 1.5.2 back into the develop branch (#2650)
* merging develop into release/1.5.2 (#2634)

* chore: tagging 1.5.2 in the changelog (#2640)

---------

Co-authored-by: Kitty Draper <284434+ShadauxCat@users.noreply.github.com>
2023-08-01 17:29:02 +00:00
Noel Stephens 422aa239ed
fix: NetworkTransform synchronization fixes and owner authoritative performance improvement on server-host [MTT-6971] (#2636)
* 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.
2023-08-01 11:51:17 -05:00
Noel Stephens fae403af67
fix: NetworkBehaviourEditor exception when using the inspector view while in play mode (#2641)
* 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.
2023-07-25 13:26:17 -05:00
Noel Stephens 6d461bfd24
fix: ilpp stripping and coreclr compatibility [NCCBUG-209] (#2614)
* 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>
2023-07-21 15:45:35 +00:00
Noel Stephens dfe7138015
fix: NetworkClient.OwnedObjects always returning a count of zero (#2631)
* 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.
2023-07-20 09:32:24 -05:00
Kitty Draper 7e4efe14b2
fix: Add null check in TrySetParent (#2625)
* fix: Add null check in TrySetParent

fixes #2621

* Added tests

* Changelog

---------

Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
2023-07-20 00:49:08 +00:00
Kitty Draper 72d6102ba3
fix: compile error with generic NetworkBehaviour singletons (#2603)
* fix: compile error with generic NetworkBehaviour singletons

* changelog

* Added another fix for a similar issue.

---------

Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
2023-07-18 16:25:05 +00:00
Noel Stephens 208d1c901c
fix: RemoveOwnership not locally notifying server that it gained ownership [MTT-6377] [MTT-6937][MTT-6936] (#2618)
* 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.
2023-07-14 21:03:39 +00:00
Noel Stephens 9af9280d45
fix: NetworkTransform full precision state updates being lost when interpolating [MTT-6799] (#2624)
* 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.
2023-07-14 11:18:00 -05:00
Noel Stephens 9ca4efb0e9
fix: shutdown causes exception if invoked twice [MTT-6752] (#2622)
* 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
2023-07-12 22:12:33 +00:00
Noel Stephens b8eed6849e
fix: NetworkObject.SpawnWithObservers was not being honored for late joining clients [MTT-6934] (#2623)
* 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.
2023-07-12 16:44:23 -05:00
Frank Luong 6ae793a651
fix: UTP test that was failing when you install Unity Transport package 2.0.0 or newer (#2616)
* removing unused log assert

* Update CHANGELOG.md

* bumping package version to 1.5.2

* adding the unreleased header in changelog
2023-07-12 12:23:43 -04:00
Kitty Draper 54666c3454
chore: Release/1.5.1 merge back to develop (#2594) 2023-06-21 14:38:23 -05:00
Kitty Draper 1c741299e5
feat: Native container serialization (#2375) 2023-05-24 22:05:45 +00:00
Kitty Draper 96def2caad
feat: Allow configuring the location of the default network prefabs list. [MTT-6209] (#2544) 2023-05-24 19:42:16 +00:00
Noel Stephens 7db429f24d
fix: OnClientDisconnected client identifier is incorrect when pending client connection is denied [MTT-6376] (#2569)
* 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
2023-05-24 19:04:11 +00:00
Kitty Draper 99a1b94913
feat: Add methods for setting max message size limits (i.e., MTU negotiation) [MTT-6214] (#2530) 2023-05-24 18:29:29 +00:00
Noel Stephens 706c6b43e6
fix: Provide SpawnWithObservers property alternative to CheckObjectVisibility [MTT-6353] (#2568)
* 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.
2023-05-23 16:31:19 -05:00
Tyler McDowall 347f3c09a6
Update CODEOWNERS 2023-05-22 13:48:35 -07:00
Kitty Draper e11cf0acf7
fix: Fixes warning logged on double-initialize of prefabs lists. (#2565)
* 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>
2023-05-20 01:23:21 +00:00
Noel Stephens 0ba68378cd
fix: server scene exclusion during synchronization for runtime generated scenes (#2550)
* 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
2023-05-19 13:51:30 +00:00
Noel Stephens 2b92028b5e
fix: Nested NetworkTransform synchronization fails when parent has non-Vector3.one scale [MTT-6304] (#2538)
* 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.
2023-05-18 17:26:34 -05:00
Noel Stephens cd50a00fe7
fix: NetworksSenemanager order of operations and scene migration preprocess (#2532)
* 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
2023-05-18 14:56:12 -05:00
Noel Stephens 9246d94bf6
fix: Remove in-editor NetworkVariable console log messages (#2562)
* Update NetworkBehaviourEditor.cs

Removing additional debug output that does not need to be spamming the console

* Update CHANGELOG.md

* Style
2023-05-16 09:54:42 -05:00
Noel Stephens 688640c485
fix: missing value on NetworkListEvent for EventType.RemoveAt events [MTT-6354] (#2559)
* 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>
2023-05-12 17:16:09 +00:00
Kitty Draper 31e5e1dc7f
fix: Generate Default Network Prefabs List setting not loading correctly (#2545)
* fix: Generate Default Network Prefabs List setting not loading correctly

* Changelog

---------

Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
2023-05-10 20:49:27 +00:00
Sara [Unity] b9850875d4
fix: update links (#2557)
* Update index.md

Fixed Installation and First Steps links for package

* Update index.md

---------

Co-authored-by: Noel Stephens <noel.stephens@unity3d.com>
2023-05-10 20:21:05 +00:00
Simon Lemay 36bb660c91
fix: Misleading error messages when not setting up Relay correctly (#2555) 2023-05-08 21:14:53 +00:00