namespace Unity.Netcode { /// /// This class is used to register user serialization with NetworkVariables for types /// that are serialized via user serialization, such as with FastBufferReader and FastBufferWriter /// extension methods. Finding those methods isn't achievable efficiently at runtime, so this allows /// users to tell NetworkVariable about those extension methods (or simply pass in a lambda) /// /// public class UserNetworkVariableSerialization { /// /// The write value delegate handler definition /// /// The to write the value of type `T` /// The value of type `T` to be written public delegate void WriteValueDelegate(FastBufferWriter writer, in T value); /// /// The write value delegate handler definition /// /// The to write the value of type `T` /// The value of type `T` to be written public delegate void WriteDeltaDelegate(FastBufferWriter writer, in T value, in T previousValue); /// /// The read value delegate handler definition /// /// The to read the value of type `T` /// The value of type `T` to be read public delegate void ReadValueDelegate(FastBufferReader reader, out T value); /// /// The read value delegate handler definition /// /// The to read the value of type `T` /// The value of type `T` to be read public delegate void ReadDeltaDelegate(FastBufferReader reader, ref T value); /// /// The read value delegate handler definition /// /// The to read the value of type `T` /// The value of type `T` to be read public delegate void DuplicateValueDelegate(in T value, ref T duplicatedValue); /// /// Callback to write a value /// public static WriteValueDelegate WriteValue; /// /// Callback to read a value /// public static ReadValueDelegate ReadValue; /// /// Callback to write a delta between two values, based on computing the difference between the previous and /// current values. /// public static WriteDeltaDelegate WriteDelta; /// /// Callback to read a delta, applying only select changes to the current value. /// public static ReadDeltaDelegate ReadDelta; /// /// Callback to create a duplicate of a value, used to check for dirty status. /// public static DuplicateValueDelegate DuplicateValue; } }