Class SyncedAttribute

Namespace
Unity.Multiplayer.Core

Marks a field on a NetEntity as replicated state. For [Synced] float _mass; the generator emits a Mass property backed by a network variable: the server writes it, every client reads it, late joiners get the current value. Writing it anywhere but the server throws (BIBLE UM-LAW-1).

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

Remarks

The field itself is only a declaration; read and write the generated property, never the field.

Properties

OnChanged

Optional: the name of a void Handler(T previous, T current) method on the same class, called on every peer (server included) whenever the value changes.

public string OnChanged { get; set; }

Property Value

string