Class NetProtocolAttribute

Namespace
Unity.Multiplayer.Core

Records a game assembly's protocol hash. The source generator emits it, once per assembly that declares RPCs or synced fields: [assembly: NetProtocol("0123456789abcdef", 12)]. Games do not write it by hand.

[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
public sealed class NetProtocolAttribute : Attribute
Inheritance
NetProtocolAttribute
Inherited Members

Remarks

FromAssemblies(IEnumerable<Assembly>) reads it back at runtime. Hash is the 16-hex-digit form of Compute(IEnumerable<string>) over the assembly's signatures.

Constructors

NetProtocolAttribute(string, int)

Records the hash and how many signatures went into it.

public NetProtocolAttribute(string hash, int signatureCount)

Parameters

hash string

16 hex digits, as ToString() writes them.

signatureCount int

The number of distinct RPC and synced-field signatures hashed.

Properties

Hash

The protocol hash as 16 hex digits.

public string Hash { get; }

Property Value

string

SignatureCount

The number of distinct RPC and synced-field signatures hashed, for diagnostics.

public int SignatureCount { get; }

Property Value

int