Structure

SynchronizationComponent

A component that synchronizes an entity between processes and networked applications.

Declaration

struct SynchronizationComponent

Overview

An entity acquires a SynchronizationComponent instance by adopting the HasSynchronization protocol. All entities have this component because the Entity base class adopts the protocol.

Topics

Creating a Synchronization Component

init()

Creates a synchronization component.

Identifying a Synchronization Component

var identifier: UInt64

A unique identifier of an entity within a network session.

Managing Ownership

var isOwner: Bool

A Boolean that indicates whether the calling process owns the entity.

enum SynchronizationComponent.OwnershipTransferCompletionResult

The result of an ownership transfer request.

Registering a Component Type

static func registerComponent()

Registers a new component type.

Comparing Synchronization Components

static func == (SynchronizationComponent, SynchronizationComponent) -> Bool

Indicates whether two synchronization components are equal.

static func != (SynchronizationComponent, SynchronizationComponent) -> Bool

Indicates whether two synchronization components are not equal.

Relationships

Conforms To

See Also

Synchronizing an Entity Among Peers

var synchronization: SynchronizationComponent?

The entity’s synchronization component.

var isOwner: Bool

A Boolean that indicates whether the calling process owns the entity.

func withUnsynchronized(() -> Void)

Calls the given closure in a way such that component changes that the closure makes don’t trigger synchronization.

protocol HasSynchronization

An interface that enables an entity to be synchronized between processes and networked applications.