Docs

Blueprint / C++ API

Everything exposed by the Version Forge API.

The full API is available in both Blueprints and C++. To use it from C++, add "VersionForge" to your module's dependencies and include the header shown in each section.

UVersionForgeStatics

Blueprint function library. Every function is static, and can be called from C++ with UVersionForgeStatics::FunctionName().

#include "VersionForgeStatics.h"

GetGameVersionInfo

Returns a fully populated FGameVersionInfo structure for the current build.

const FGameVersionInfo Info = UVersionForgeStatics::GetGameVersionInfo();
UE_LOG(LogTemp, Log, TEXT("Build %d on %s"), Info.BuildNumber, *Info.Platform);

GetVersionString

Returns the Long Version string, formatted with the Format Template setting. For example 1.5.7+Windows.Shipping.20261123.418.

const FString Version = UVersionForgeStatics::GetVersionString();

GetShortVersionString

Returns the Short Version string, the Long Version string without the metadata after the first +. For example 1.5.7, or 1.5.7-beta.

const FString Short = UVersionForgeStatics::GetShortVersionString();

FormatVersionString

Formats a FGameVersionInfo with the provided template.

Tokens: {major} {minor} {patch} {projectpatch} {build} {cl} {prerelease} {platform} {config} {date}

See Format Template for details.

const FGameVersionInfo Info = UVersionForgeStatics::GetGameVersionInfo();
const FString Text = UVersionForgeStatics::FormatVersionString(Info, TEXT("v{major}.{minor} (build {build})"));

GetNetworkVersionString

Returns the Network Version string, resolved from the Network Version Source setting.

const FString NetworkVersion = UVersionForgeStatics::GetNetworkVersionString();

GetMajorVersion

Returns the first segment of the version number.

const int32 Major = UVersionForgeStatics::GetMajorVersion();

GetMinorVersion

Returns the second segment of the version number.

const int32 Minor = UVersionForgeStatics::GetMinorVersion();

GetPatchVersion

Returns the third segment of the version number resolved from the Patch Source setting. It can be Project Patch, the Build Number, or the Changelist if numeric.

const int32 Patch = UVersionForgeStatics::GetPatchVersion();

GetProjectPatchVersion

Returns the third segment of Project Version regardless of the Patch Source setting.

const int32 ProjectPatch = UVersionForgeStatics::GetProjectPatchVersion();

AreBuildValuesAvailable

Returns true when a packaged build contains build values Version Forge captured at build time. Returns false in the editor or if a build did not capture any values.

if (!UVersionForgeStatics::AreBuildValuesAvailable())
{
	// No build values
}

GetBuildNumber

Returns the build number captured at build time, or 0 if none was captured.

const int32 Build = UVersionForgeStatics::GetBuildNumber();

GetChangelist

Returns the changelist or commit identifier captured at build time, or an empty string if none was captured.

const FString Changelist = UVersionForgeStatics::GetChangelist();

GetPlatform

Returns the platform the game (or editor) was built for, such as Windows, Mac, Android, or IOS.

const FString Platform = UVersionForgeStatics::GetPlatform();

GetConfiguration

Returns the configuration that was built, such as Development or Shipping. Returns Editor during PIE.

const FString Config = UVersionForgeStatics::GetConfiguration();

GetBuildDate

Returns the timestamp captured at build time, or midnight UTC of the current date in the editor.

const FDateTime BuildDate = UVersionForgeStatics::GetBuildDate();
const FString Day = BuildDate.ToString(TEXT("%Y-%m-%d"));

GetPreReleaseTag

Returns the pre-release label: alpha, beta, rc, ea, or your custom tag. Empty when none is configured.

const bool bIsPreRelease = !UVersionForgeStatics::GetPreReleaseTag().IsEmpty();

CompareGameVersions

Compares Major.Minor.Patch values.

Returns:

  • -1 if A is older than B
  • 0 if A and B are equal
  • 1 if A is newer than B.
if (UVersionForgeStatics::CompareGameVersions(SavedVersion, UVersionForgeStatics::GetGameVersionInfo()) < 0)
{
    MigrateSaveData();
}

IsGameVersionAtLeast

Returns true if Version is greater than or equal to the provided Major.Minor.Patch.

const FGameVersionInfo Current = UVersionForgeStatics::GetGameVersionInfo();
if (UVersionForgeStatics::IsGameVersionAtLeast(Current, 1, 2, 0))
{
    EnableNewMenu();
}

FGameVersionInfo

The struct that contains every part of the version information for a build.

#include "VersionForgeTypes.h"
PropertyTypeDescription
Majorint32First segment of the version number.
Minorint32Second segment of the version number.
ProjectPatchint32Third segment of Project Version.
Patchint32Third segment of the version number, resolved from the Patch Source setting.
BuildNumberint32Build number captured at build time, or 0 if none.
ChangelistFStringChangelist or commit identifier captured at build time, or empty string if none.
PlatformFStringPlatform the game was built for, such as Windows.
ConfigurationFStringBuild configuration, such as Development or Shipping.
BuildDateFDateTimeDate and time captured at build time, or the current date in the editor.
PreReleaseTagFStringalpha, beta, rc, ea, or your custom tag. Empty if none.

MakeGameVersionInfo

Builds a FGameVersionInfo struct from the provided Major.Minor.Patch values. The other fields are left at their defaults.

const FGameVersionInfo Required = UVersionForgeStatics::MakeGameVersionInfo(1, 2, 0);
const bool bOutdated = UVersionForgeStatics::CompareGameVersions(Current, Required) < 0;

BreakGameVersionInfo

Splits a FGameVersionInfo into its individual fields.

int32 Major, Minor, ProjectPatch, Patch, BuildNumber;
FString Changelist, Platform, Configuration, PreReleaseTag;
FDateTime BuildDate;
UVersionForgeStatics::BreakGameVersionInfo(Info, Major, Minor, ProjectPatch, Patch, BuildNumber, Changelist, Platform, Configuration, BuildDate, PreReleaseTag);

UVersionTextBlock

A UMG UTextBlock widget that displays the current version. Font, color, justification, etc are all customizable. Appears in the UMG Palette under the Version Forge category as Version Text.

#include "VersionTextBlock.h"

SetDisplayMode

Changes DisplayMode and refreshes the text.

VersionText->SetDisplayMode(EVersionTextMode::NetworkVersion);

SetPrefixWithV

Changes bPrefixWithV and refreshes the text.

VersionText->SetPrefixWithV(true);

SetCustomFormat

Changes CustomFormat and refreshes the text. Changes DisplayMode to Custom.

VersionText->SetCustomFormat(FText::FromString(TEXT("v{major}.{minor}.{patch}")));

On this page