Class NetworkTransformOwnershipTests
Inheritance
Inherited Members
Namespace: Unity.Netcode.RuntimeTests
Assembly: Unity.Netcode.RuntimeTests.dll
Syntax
public class NetworkTransformOwnershipTests : IntegrationTestWithApproximation
Properties
NumberOfClients
Declaration
protected override int NumberOfClients { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
Methods
LateJoinedNonOwnerClientCannotChangeTransform()
This test verifies a late joining client cannot change the transform when:
- A NetworkObject is spawned with a host and one or more connected clients
- The NetworkTransform is owner authoritative and spawned with the host as the owner
- The host does not change the transform values
- One of the already connected clients gains ownership of the spawned NetworkObject
- The new client owner does not change the transform values
- A new late joining client connects and is synchronized
- The newly connected late joining client tries to change the transform of the NetworkObject it does not own
Declaration
[UnityTest]
public IEnumerator LateJoinedNonOwnerClientCannotChangeTransform()
Returns
Type | Description |
---|---|
IEnumerator |
OnNewClientCreated(NetworkManager)
Clients created during a test need to have their prefabs list updated to match the server's prefab list.
Declaration
protected override void OnNewClientCreated(NetworkManager networkManager)
Parameters
Type | Name | Description |
---|---|---|
Network |
networkManager |
Overrides
OnServerAndClientsCreated()
This is invoked before the server and client(s) are started. Override this method if you want to make any adjustments to their NetworkManager instances.
Declaration
protected override void OnServerAndClientsCreated()
Overrides
OwnerAuthoritativeTest(StartingOwnership)
This verifies that when authority is owner authoritative the owner's Rigidbody is kinematic and the non-owner's is not. This also verifies that we can switch between owners and that only the owner can update the transform while non-owners cannot.
Declaration
[UnityTest]
public IEnumerator OwnerAuthoritativeTest(NetworkTransformOwnershipTests.StartingOwnership startingOwnership)
Parameters
Type | Name | Description |
---|---|---|
Network |
startingOwnership |
Returns
Type | Description |
---|---|
IEnumerator |
ServerAuthoritativeTest()
This verifies that when authority is server authoritative the client's Rigidbody is kinematic and the server is not. This also verifies only the server can apply updates to the transform while the clients cannot.
Declaration
[UnityTest]
public IEnumerator ServerAuthoritativeTest()
Returns
Type | Description |
---|---|
IEnumerator |