Files
Jason Larabie effb471b68 Add Unreal Result type to support C++ and Blueprint (#3834)
# Description of Changes

- Updated Unreal codegen to work with ::Result to match how ::Option
works to create a new struct for each type pair identified
- Added new integration tests to confirm Ok state for all new types
added to sdk-tests
- Added new UE_SPACETIMEDB_RESULT macro to capture de/serialization for
the new structs

# API and ABI breaking changes

N/A

# Expected complexity level and risk

2 - Added new type generated from Result which creates new structs for
each one identified

# Testing

- [x] Updated the integration tests to include the new Result types

---------

Co-authored-by: Mario Alejandro Montoya Cortes <mamcx@elmalabarista.com>
2026-01-14 23:32:02 +00:00
..

SpacetimeDB Unreal SDK

This folder contains the Unreal Engine plugin that allows games to talk to a SpacetimeDB server. The design mirrors the official Rust SDK and borrows ideas from the C# SDK so that projects can share a common workflow across languages.

Overview

The plugin exposes a high level API for establishing connections, invoking reducers and keeping a synchronized cache of database tables. Communication happens over WebSockets using the BSATN binary format. Most of the message and type headers are generated by the SpacetimeDB CLI so that Unreal games can send and receive the same structures as other SDKs.

Feature Highlights

  • Connect to a SpacetimeDB server and authenticate with identity tokens
  • Call reducers and receive their results via Blueprint exposed delegates
  • Subscribe to queries and maintain a local table cache updated by server diffs
  • Serialize common Unreal types to BSATN, including arrays
  • Auto-generated table types keep the API in sync with your database
  • Pure C++ implementation with Blueprint wrappers for easy gameplay scripting

Directory Layout

crates/sdk-unreal/
├── DEVELOP.md           # Notes on integrating the plugin into a project
├── SpacetimeDbSdk/      # The Unreal plugin sources
│   ├── Resources/       # Plugin icons and metadata
│   └── Source/
│       └── SpacetimeDbSdk/
│           ├── Public/  # Headers used by gameplay code
│           │   ├── BSATN/       # BSATN serializer
│           │   ├── Connection/  # Connection and subscription classes
│           │   ├── DBCache/     # Client side table cache utilities
│           │   ├── Tables/      # Base class for generated table wrappers
│           │   ├── Types/       # Generated message and type headers
│           │   └── tests/       # Unit test helpers for BSATN
│           ├── Private/ # Implementation files
│           └── SpacetimeDbSdk.Build.cs

See the README files in each subfolder for more details on the available classes and helpers.

Getting Started

  1. Copy SpacetimeDbSdk into your project's Plugins directory or use the AdditionalPluginDirectories option described in DEVELOP.md.
  2. Regenerate the headers under Public/Types by running the SpacetimeDB CLI against your module schema.
  3. Include SpacetimeDbSdk in your game's build files and start a connection using UDbConnectionBuilder.

With the connection established you can call reducers, subscribe to queries and drive gameplay logic using incoming table data.