Sending and receiving component updates
A simulated world changes through updates to components of entities. Workers can send component updates and receive component updates.
On this page:
For an idea of which workers could make which kind of updates, see the introduction to workers.
Getting access to a component
In order to get information about a component, or make changes to an entity, workers need to be given access, using an access control list on each entity.
For more information, see Access control lists.
Sending component updates
To send a component update, a worker needs to have write access and be given authority over the component. Only one worker at a time will be given authority over a particular component of a particular entity by SpatialOS at any given time.
For details on how to send component updates, see the language-specific docs:
- Unity docs
- C++ worker docs, in particular Sending component updates
- C# worker docs, in particular Sending component updates
- Java worker docs, in particular Sending component updates
Receiving component updates
The API that workers use to receive component updates comes from schema, generated for all supported SDKs. Every single worker that can see the entity and the component will receive updates. A component update can be partial, i.e. it can update only some properties of a component, and does not necessarily have to contain data that is different from the current state as viewed by the worker. Note that component updates can also be sent by SpatialOS for synchronization purposes, i.e. they do not have to have been sent by user code.
For details on how to receive component updates, see the language-specific docs:
Accessing the current state of components
The base language SDKs optionally provide a View that allows you to access the current state of the component, as seen by the worker. It is available in C++, C#, and Java. UnitySDK provides an alternative way of accessing the current state.
Was this page helpful?
Thanks for letting us know!
Thanks for your feedback
Need more help? Ask on the forums