Temporary components

Note: This document relates to the ECS workflow.

A temporary component is a type of component which only exists for a single frame. This pattern is useful when you want to represent transient events as an ECS component, for example, the OnConnected component which denotes that your worker has connected to the SpatialOS Runtime as described in the ECS: Worker entity documentation.

We provide you with the Improbable.Gdk.Core.RemoveAtEndOfTick attribute, which can be applied to any ECS component to make it a temporary component.

If a temporary component is added to an entity, the GDK removes the component using the CleanTemporaryComponentsSystem at the end of the update loop. This means that when you use temporary components, you must consider the ordering of your systems carefully. Any system which runs logic predicated on the temporary component should be run after the temporary component is added and before it is removed.

The following code snippet shows an example of how to annotate your ECS component with the RemoveAtEndOfTick attribute.

public struct SomeTemporaryComponent : IComponentData

Updated about a year ago

Temporary components

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.