Skip to content

Firebase Value

The Firebase Value structure represents a single typed value used specifically by Firestore and Realtime Database in this plugin. It is the core data unit for building documents, fields, arrays, and nested objects when working with Firebase databases.

FFirebaseValue was introduced to provide a safe, typed alternative to manual JSON construction and is used only in database-related Firebase modules.


Role in Firestore and Realtime Database

FFirebaseValue is the basic data unit used by Firestore and Realtime Database in this plugin.

In Firestore, every document field is stored as a FFirebaseValue, and FFirestoreDocument is simply a container that maps field names to Firebase Values.

In Realtime Database, values are written to paths and received from listeners directly as FFirebaseValue, without any document wrapper.

All database APIs operate on FFirebaseValue instead of raw JSON strings, providing safe serialization, type correctness, and proper handling of arrays and nested objects in both C++ and Blueprint.


EFirebaseValueType

Defines the type of a Firebase database value.

Name Description
None No value is set.
Int Integer value (int32).
Bool Boolean value.
Double Double-precision floating-point value.
String UTF-8 string value.
Object Nested object represented as a map of values.
Array Array of Firebase values.
Null Explicit null value.

FFirebaseValue

FFirebaseValue represents a single typed database value with an associated EFirebaseValueType.

It supports:

  • primitive values
  • nested objects
  • arrays
  • explicit nulls

The structure is recursive, allowing complex Firestore documents and Realtime Database payloads to be built safely.


Fields

Field Type Description
Type EFirebaseValueType The type of the stored value.
IntValue int32 Stored integer value (when type is Int).
BoolValue bool Stored boolean value (when type is Bool).
DoubleValue double Stored double value (when type is Double).
StringValue FString Stored string value (when type is String).
ObjectValue TSharedPtr<TMap<FString, FFirebaseValue>> Stored object value (when type is Object).
ArrayValue TSharedPtr<TArray<FFirebaseValue>> Stored array value (when type is Array).

Factory Functions (C++)

These functions create Firebase database values of a specific type and are primarily intended for C++ usage. Blueprint equivalents are provided via the Firebase Value Library.

Function Parameters Description
MakeInt Value Creates an integer value.
MakeBool Value Creates a boolean value.
MakeDouble Value Creates a double value.
MakeString Value Creates a string value.
MakeObject Object Creates an object value from a map of values.
MakeArray Array Creates an array value.
MakeNull Creates a null value.

Getters (C++)

Function Returns Description
GetInt int32 Returns the integer value or 0 if the type does not match.
GetBool bool Returns the boolean value or false if the type does not match.
GetDouble double Returns the double value or 0.0 if the type does not match.
GetString FString Returns the string value or an empty string if the type does not match.
GetObject TMap<FString, FFirebaseValue> Returns the object value or an empty map if the type does not match.
GetArray TArray<FFirebaseValue> Returns the array value or an empty array if the type does not match.
GetType EFirebaseValueType Returns the value type.

Type Checks (C++)

Function Returns Description
IsInt bool Returns true if the value is an integer.
IsBool bool Returns true if the value is a boolean.
IsDouble bool Returns true if the value is a double.
IsString bool Returns true if the value is a string.
IsNumber bool Returns true if the value is an integer or double.
IsObject bool Returns true if the value is an object.
IsArray bool Returns true if the value is an array.
IsNull bool Returns true if the value is null.

JSON Serialization

FFirebaseValue handles JSON serialization internally and does not require any manual JSON handling in normal usage.

The following functions are internal helpers used by the plugin when communicating with Firebase services and are not intended to be called directly in gameplay or application code:

  • ToJsonValue()
  • ToJsonString()
  • FromJsonValue()
  • FromJsonString()

Blueprint Access

In Blueprint, Firebase database values are created and accessed exclusively through the Firebase Value Library.

The Blueprint library exposes:

  • value creation nodes
  • safe getters
  • type checks

Blueprint users should never manually construct JSON strings. All Firestore and Realtime Database APIs expect FFirebaseValue and handle serialization internally.

C++ users may use either native FFirebaseValue functions or the Blueprint library for consistency.