Get SpatialOS

Sites

Menu

SpatialOS entities: API - EntityBuilder

This document relates to both MonoBehaviour and ECS workflows

Before reading this document, make sure you are familiar with the documentation on entity templates.

Use the EntityBuilder class to create entity templates. You use the EntityTemplate class to specify all the components that a SpatialOS entity has, the initial values of those components, and which workers have write access to each component.

The EntityBuilder class is part of the Improbable.Gdk.Core assembly.

Public methods

Each method returns the EntityBuilder instance using the builder design pattern (Wikipedia).

Methods

.Begin()

Create a new EntityBuilder instance for creating an EntityTemplate.

.AddPosition(double x, double y, double z, string writeAccess)

Add a Position component to your entity and specify which worker type(s) can have authority over it.

.SetPersistence(bool persistence)

Specify whether your entity should be saved in snapshots. For more information, see the SpatialOS documentation on persistence.

.SetReadAcl(string attribute, param string[] attribute)
.SetReadAcl(List<string> attribute)

Specify which worker type(s) can have read access to the entity.

.SetEntityAclComponentWriteAccess(string attribute)

Specify which worker type can have write access over the EntityAcl component of your entity. This is useful if, while the game is running, you want to change which worker type(s) can have write-access over the entity’s other components.

.AddComponent(ComponentData data, string writeAccess)

Add a user-defined component to your entity and specify which worker type(s) can have [write access]((/unity/alpha/content/glossary#authority) over it.

.Build()

Create a finished EntityTemplate.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums