Serialization::RealtimeSet

RealtimeSet is a special model type that can be used in your own custom models. It represents an unordered collection of models. Internally this is used for things like keeping track of all RealtimeViews in the scene. If order is not important, this collection is the recommended collection to use for storing collections of models.

Adding or removing items sends the minimal amount of information to the server in order to perform the update on all clients. The whole collection is not sent every time.


Properties

Methods

Events

Property Definitions

int Count

The total number of items in the RealtimeSet, including the items that have been added locally and have yet to be confirmed by the server.

Method Definitions

bool Add(TValue value)

Adds a model to the RealtimeSet. This method will immediately fire a modelAdded event. If the add operation is rejected by the server (due to this client not having permissions to edit this model), a modelRemoved event will fire when the server’s response is received.

bool Remove(TValue value)

Removes a model from the RealtimeSet. This method will immediately fire a modelRemoved event. If the remove operation is rejected by the server (due to this client not having permissions to edit this model), a modelAdded event will fire when the server’s response is received.

Event Definitions

ModelAdded modelAdded

The total number of items in the RealtimeSet, including the items that have been added locally and have yet to be confirmed by the server.

ModelRemoved modelRemoved

An event that fires whenever an item is removed. This event includes a boolean to signal whether the model was added by the local client or a remote client.