Spatial Type

Spatial Type (SpatialType) is a SpatialOS-specific class specifier (Unreal documentation). The GDK uses SpatialType to expose network-relevant class information to SpatialOS.

SpatialType is similar to other Unreal class specifiers, but implemented in parallel with EClassFlags (Unreal documentation) to minimize the possibility of conflicting changes between the standard Unreal Engine and the GDK’s Unreal Engine fork.

The SpatialType tag allows the GDK to interoperate between the network stacks of native Unreal and SpatialOS. The tag is inherited down class hierarchies.

Classes with automatic SpatialType tagging

The GDK automatically adds a SpatialType tag to classes that inherit from either:

  • AActor
  • UActorComponents
  • UGameplayAbility

This ensures the GDK inspects all relevant Actor classes and generates schema for them if they have any properties tagged with Replicated or Handover, or they have RPC functions. If you do not want the GDK to tag your class inheriting from AActor, UActorComponent or UGameplayAbility, you can manually add a NotSpatialType tag to your class.

Classes that need manual SpatialType tagging

You need to manually tag as SpatialType any classes that do not inherit from:

  • AActor
  • UActorComponents
  • UGameplayAbility

This means you need to manually tag any classes that are subobjects, or only accessible to server-workers. These classes also need SpatialType descriptors.

SpatialType descriptors

You can add descriptors to the SpatialType tag to define additional information SpatialOS needs to know about your Unreal class.
These are:

  • ServerOnly: this indicates this class is only relevant to server-workers.
  • NotPersistent: this indicates that a class should not persist in the snapshot (by default all classes persist).

How to manually tag classes as SpatialType

Adding the specifier and descriptors to your Unreal C++ class

Like other Unreal class specifiers, you specify the SpatialType and descriptors within your class’s UCLASS macro.

For example;

UCLASS(SpatialType)
class AMyReplicatingActor : public AActor
{
GENERATED_BODY()
...
}

To add SpatialType descriptors, use the following format;

UCLASS(SpatialType=Singleton)
class AMySingleton : public AActor
{
GENERATED_BODY()
...
}

Adding the specifier and descriptors to your Unreal Blueprint class

You can also tag your Blueprint classes with the SpatialType tag and descriptors. To do this,

  1. Open the class in the Blueprint Editor and, from the menu, select Class Settings.
  2. Ensure that the Spatial Type checkbox is selected.
  3. Add any descriptors to the Spatial Description textbox, like so:

2020-08-04 Page updated with editorial review: removed references to Singleton Actors
2020-04-16 Page updated with editorial review: updated classes that automatically have SpatialType tagged and those that don't.

Updated 12 months ago


Spatial Type


Suggested Edits are limited on API Reference Pages

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