Class GenerateSerializationForGenericParameterAttribute
Marks a generic parameter in this class as a type that should be serialized through
Network
Network
Network
Network
Network
The parameter is indicated by index (and is 0-indexed); for example:
[SerializesGenericParameter(1)]
public class MyClass<TTypeOne, TTypeTwo>
{
}
This tells the code generation for Network
Note that this is primarily intended to support subtypes of Network
This attribute is properly inherited by subclasses. For example:
[SerializesGenericParameter(0)]
public class MyClass<T>
{
}
public class MySubclass1 : MyClass<Foo>
{
}
public class MySubclass2<T> : MyClass<T>
{
}
[SerializesGenericParameter(1)]
public class MySubclass3<TTypeOne, TTypeTwo> : MyClass<TTypeOne>
{
}
public class MyBehaviour : NetworkBehaviour
{
public MySubclass1 TheValue;
public MySubclass2<Bar> TheValue;
public MySubclass3<Baz, Qux> TheValue;
}
The above code will trigger generation of serialization code for Foo (passed directly to the base class), Bar (passed indirectly to the base class), Baz (passed indirectly to the base class), and Qux (marked as serializable in the subclass).
Inherited Members
Namespace: Unity.Netcode
Assembly: Unity.Netcode.Runtime.dll
Syntax
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct, AllowMultiple = true)]
public class GenerateSerializationForGenericParameterAttribute : Attribute
Constructors
GenerateSerializationForGenericParameterAttribute(int)
Declaration
public GenerateSerializationForGenericParameterAttribute(int parameterIndex)
Parameters
Type | Name | Description |
---|---|---|
int | parameterIndex |