Get SpatialOS

Sites

Menu

PlayerLifecycleHelper Class

Namespace: Improbable.Gdk.PlayerLifecycle
GDK package: PlayerLifecycle
Source


Static Methods

AddPlayerLifecycleComponents Source
void AddPlayerLifecycleComponents(EntityTemplate template, string clientWorkerId, string serverAccess)

Adds the SpatialOS components used by the player lifecycle module to an entity template.

Parameters
  • EntityTemplate template : The entity template to add player lifecycle components to.
  • string clientWorkerId : The ID of the client-worker.
  • string serverAccess : The server-worker write access attribute.
IsOwningWorker Source
bool IsOwningWorker(SpatialEntityId entityId, World workerWorld)

Returns whether an entity is owned by a worker. It can be used to determine whether a client-worker is responsible for a particular player entity.

Returns:
True if the entity with ID entityId contains an OwningWorker component with a value matching the workerWorld's workerId. False if the entity does not contain an OwningWorker component, or if the value does not match the workerId. Throws an InvalidOperationException if workerWorld does not contain a WorkerSystem, or if the entity does not exist in the worker's view.

Parameters
  • SpatialEntityId entityId : An ECS component containing a SpatialOS Entity ID.
  • World workerWorld : An ECS World associated with a worker.
AddClientSystems Source
void AddClientSystems(World world, bool autoRequestPlayerCreation = true)

Adds all the systems a client-worker requires for the player lifecycle module.

Parameters
  • World world : A world that belongs to a client-worker.
  • bool autoRequestPlayerCreation : An option to toggle automatic player creation.
AddServerSystems Source
void AddServerSystems(World world)

Adds all the systems a server-worker requires for the player lifecycle module.

Parameters
  • World world : A world that belongs to a server-worker.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums