Class NetworkBehaviourSynchronizeFailureComponent
A test NetworkBeahviour that simulates various types of synchronization failures and provides a synchronization success version to validate that synchronization will continue if user synchronization code fails.
Inheritance
Inherited Members
Namespace: Unity.Netcode.RuntimeTests
Assembly: solution.dll
Syntax
public class NetworkBehaviourSynchronizeFailureComponent : NetworkBehaviour
Properties
ClientSpawnCount
Declaration
public static int ClientSpawnCount { get; }
Property Value
Type | Description |
---|---|
int |
NumberOfFailureTypes
Declaration
public static int NumberOfFailureTypes { get; }
Property Value
Type | Description |
---|---|
int |
ServerSpawnCount
Declaration
public static int ServerSpawnCount { get; }
Property Value
Type | Description |
---|---|
int |
Methods
AssignNextFailureType()
Declaration
public void AssignNextFailureType()
OnNetworkSpawn()
Gets called when the NetworkObject gets spawned, message handlers are ready to be registered and the network is setup.
Declaration
public override void OnNetworkSpawn()
Overrides
OnSynchronize<T>(ref BufferSerializer<T>)
Override this method if your derived NetworkBehaviour requires custom synchronization data. Note: Use of this method is only for the initial client synchronization of NetworkBehaviours and will increase the payload size for client synchronization and dynamically spawned NetworkObjects.
Declaration
protected override void OnSynchronize<T>(ref BufferSerializer<T> serializer) where T : IReaderWriter
Parameters
Type | Name | Description |
---|---|---|
BufferSerializer<T> | serializer | The serializer to use to read and write the data. |
Type Parameters
Name | Description |
---|---|
T | Either BufferSerializerReader or BufferSerializerWriter, depending whether the serializer is in read mode or write mode. |
Overrides
Remarks
When serializing (writing) this will be invoked during the client synchronization period and when spawning new NetworkObjects. When deserializing (reading), this will be invoked prior to the NetworkBehaviour's associated NetworkObject being spawned.
ResetBehaviour()
Declaration
public static void ResetBehaviour()