Skip to main content

ChildSyncableCollectionBase<T>

An abstract class in Root.Township, the global namespace.

Base for a component that syncs a list of child items (woodcut points, forged points) on its entity, in full or one at a time.

Constructors​

MemberWhat it is
protected ChildSyncableCollectionBase()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
protected List<T> childrenBacking list for Children.
protected bool isForcedFullSyncTrue while sending a full sync to a joining player.
protected bool isGettingChildrenInspector button field for GetChildren.
protected MethodSync syncThe full sync message.
protected MethodSyncStruct<uint> syncIndividualThe message that syncs one child by index.

Properties​

MemberWhat it is
List<T> Children { get; }The children being synced.
protected virtual bool IsUsingSyncMessage { get; }Whether the full sync message is used. True by default.

Events​

MemberWhat it is
event Action<bool> SyncReceivedRaised when a sync arrives, with whether it was a full sync.

Methods​

MemberWhat it is
void AddChild(T child)Adds a child to the list.
void GetChildren()Editor button: adds every matching component in the object's children. Only works when the child type is a component.
override void OnConnected(Player player)Server: sends a joining player a forced full sync.
virtual void SyncAllChildren()Sends the full sync to the chunk.
abstract void SyncChild(T child)Implemented by subclasses to sync one child.
protected virtual void OnSyncReceived(bool isFull)Raises SyncReceived.
protected virtual void OnValidate()Editor hook. Empty in the base class.

Used in​

Members of other types that take, return or hold a ChildSyncableCollectionBase&lt;T>: