Preparing search index...

    Class acting as a bridge between a ScriptComponent and RealtimeStore.

    Index

    Constructors

    Properties

    currentStore: GeneralDataStore

    GeneralDataStore created for this SyncEntity and used to store its state. Will be null if the SyncEntity's setup hasn't finished.

    destroyed: boolean = false

    If true, this SyncEntity has been marked as destroyed and should not be interacted with.

    isSetupFinished: boolean = false

    If true, the SyncEntity's setup has finished and it can be fully used.

    The NetworkedScriptComponent this SyncEntity is attached to.

    messaging: NetworkMessageWrapper<unknown>

    Provides direct access to the NetworkMessageWrapper used by SyncEntity events.

    networkId: string

    Unique NetworkId string used to identify this SyncEntity.

    networkRoot: NetworkRootInfo = null

    Provides information about the instantiated Prefab, if this SyncEntity was instantiated. Otherwise, is null.

    onDestroyed: EventWrapper<[void]> = ...

    Event triggered when the SyncEntity is destroyed (both locally or remotely).

    onEventReceived: KeyedEventWrapper<[NetworkMessage<unknown>]>

    Event triggered whenever this SyncEntity receives a network event, including ones sent by the local user.

    onLocalDestroyed: EventWrapper<[void]> = ...

    Event triggered when the SyncEntity is destroyed locally (by the local user).

    onOwnerUpdated: EventWrapper<[UserInfo]> = ...

    Event triggered when the SyncEntity's owner changes.

    onRemoteDestroyed: EventWrapper<[void]> = ...

    Event triggered when the SyncEntity is destroyed remotely (by another user).

    onRemoteEventReceived: KeyedEventWrapper<[NetworkMessage<unknown>]>

    Event triggered whenever this SyncEntity receives a network event, but only from remote users.

    onSetupFinished: EventWrapper<[void]> = ...

    Event triggered with the SyncEntity's setup is finished. It's recommended to use SyncEntity.notifyOnReady() instead, since it will call back immediately if setup has already finished.

    ownerInfo: UserInfo = null

    UserInfo of the SyncEntity's owner, if one exists. Otherwise null.

    persistence: Persistence

    Returns the persistence setting for the SyncEntity.

    propertySet: StoragePropertySet

    The StoragePropertySet used by this SyncEntity. Each StorageProperty in the set will automatically be kept updated.

    storeCallbacks: StoreEventWrapper

    Provides direct access to helpful callbacks related to the SyncEntity's currentStore.

    Methods

    • Returns true if the local connection is allowed to modify the SyncEntity's data store. This means that setup has finished, and either the SyncEntity is unowned or the local user is the owner.

      Returns boolean

      Whether the local connection can modify the store

    • Creates a new standalone SyncEntity that is not tied to a ScriptComponent.

      Parameters

      • networkId: string

        The network ID

      • OptionalpropertySet: StoragePropertySet

        Optional set of StorageProperties the SyncEntity will be initialized with

      • OptionalclaimOwnership: boolean

        Whether to claim ownership

      • Optionalpersistence: Persistence | "Ephemeral" | "Owner" | "Session" | "Persist"

        The persistence setting

      Returns SyncEntity

      The new SyncEntity

    • Destroys the SyncEntity. If attached to a ScriptComponent, the SceneObject will also be destroyed.

      Returns void

    • Returns true if the local connection owns the SyncEntity's data store. This means that setup has finished, and the local user owns the store.

      Returns boolean

      Whether the local connection owns the store

    • Returns a SyncEntity with matching network id, or null if none exists.

      Parameters

      • networkId: string

        The network ID

      Returns SyncEntity

      SyncEntity with matching network ID, or null

    • Returns the connectionId string of the SyncEntity's current owner, or null if none exists.

      Returns string

      The connectionId or null

    • Returns the connectionId string of the SyncEntity's current owner, or null if none exists.

      Returns string

      The connectionId or null

    • Returns the userId string of the SyncEntity's current owner, or null if none exists.

      Returns string

      The userId or null

    • Returns the MultiplayerSession used by the SessionController, if a session exists. Otherwise, returns null.

      Returns MultiplayerSession

      The MultiplayerSession or null

    • Returns a SyncEntity stored on the component if one exists, otherwise null.

      Parameters

      Returns SyncEntity

      SyncEntity found on component, or null

    • Returns the first SyncEntity found on a component attached to sceneObject, or null if none is found.

      Parameters

      Returns SyncEntity

      SyncEntity found on sceneObject, or null

    • Returns true if setup is finished, and any user owns the SyncEntity's data store.

      Returns boolean

      Whether the store is owned

    • Calls the onReady callback as soon as the SyncEntity's setup is completed. If setup is already completed, the callback will be executed immediately.

      Parameters

      • onReady: () => void

        Called as soon as the SyncEntity setup has completed

      Returns void

    • Put in an ownership request of this SyncEntity for the local user. If the local user already owns the SyncEntity, onSuccess will be called immediately.

      Parameters

      • OptionalonSuccess: (store: GeneralDataStore) => void

        Called as soon as ownership was successfully gained

      • OptionalonError: (error: string) => void

        Called if an error occurs

      Returns void

    • Send a network event to all copies of this SyncEntity.

      Parameters

      • eventName: string

        Name identifying the event

      • OptionaleventData: unknown

        Optional object of any data type that can be included with the event

      • OptionalonlySendRemote: boolean

        If true, this event won't be received by the local SyncEntity that sent it

      Returns void

    • Put in an ownership request of this SyncEntity for the local user. The request will be stored if not immediately possible, and try to be honored whenever it becomes possible. If the local user already owns the SyncEntity, onSuccess will be called immediately.

      Parameters

      • OptionalonSuccess: (store: GeneralDataStore) => void

        Called as soon as ownership was successfully gained

      • OptionalonError: (error: string) => void

        Called if an error occurs

      Returns void

    • Try to revoke ownership if the local user owns this SyncEntity, otherwise onSuccess is called immediately.

      Parameters

      • OptionalonSuccess: (store: GeneralDataStore) => void

        Called if the ownership was revoked successfully

      • OptionalonError: (error: string) => void

        Called if an error occurs

      Returns void