Method Read
Read(FastBufferReader, ref T)
Deserialize a value using the best-known serialization method for a generic value.
Will reliably deserialize any value that is passed to it correctly with no boxing.
For types whose deserialization can be determined by codegen (which is most types),
GC will only be incurred if the type is a managed type and the ref value passed in is null
,
in which case a new value is created; otherwise, it will be deserialized in-place.
Note: If you are using this in a custom generic class, please make sure your class is
decorated with GenerateSerializationForGenericParameterAttribute so that codegen can
initialize the serialization mechanisms correctly. If your class is NOT
generic, it is better to use FastBufferReader directly.
If the codegen is unable to determine a serializer for a type,
UserNetworkVariableSerialization<T>.ReadValue is called, which, by default,
will throw an exception, unless you have assigned a user deserialization callback to it at runtime.
Declaration
public static void Read(FastBufferReader reader, ref T value)
Parameters
Type | Name | Description |
---|---|---|
FastBufferReader | reader | |
T | value |