Skip to content

C++ Plugin V2.9 Migration Guide

This guide will help you update your code to work with the V2.9 version of the GameFuse C++ plugin. The main changes involve moving from GameFuseCore to the new GameFuseManager subsystem and updating data types from UObjects to structs.

Major Changes Overview

  1. GameFuseCoreGameFuseManager Subsystem
  2. UObject-based data → Struct-based data
  3. Latent nodes → Delegate-based callbacks

Step-by-Step Migration

1. Replace GameFuseCore with GameFuseManager

Before:

UGameFuseCore* GameFuseCore = NewObject<UGameFuseCore>();
GameFuseCore->SetUpGame("YourGameId", "YourToken");

After:

UGameFuseManager* GameFuseManager = GetGameInstance()->GetSubsystem<UGameFuseManager>();
GameFuseManager->SetUpGame("YourGameId", "YourToken", CompletionCallback);

The GameFuseManager pointer can be stored as a member variable as it is linked to the game instance.

TObjectPtr<UGameFuseManager> GameFuseManager;

2. Update Data Type Usage

Structs have been introduced for GameData, UserData, StoreItems, LeaderboardEntries and Leaderboards. See GameFuseStructLibrary for schema of these structs.

Before:

TArray<UGameFuseStoreItem*> StoreItems = UGameFuseCore::GetGameStoreItems();
for (UGameFuseStoreItem* Item : StoreItems)
{
    FString ItemName = Item->GetName();
    int32 Cost = Item->GetCost();
}

After:

TArray<FGFStoreItem> StoreItems = UGameFuseManager::GetGameStoreItems();
for (const FGFStoreItem& Item : StoreItems)
{
    FString ItemName = Item.Name;
    int32 Cost = Item.Cost;
}

3. Update Delegate Callbacks

Delegates are now declared as Dynamic Multicast Delegates, which return the FGFAPIResponse struct. You can bind to these delegates in your C++ code by creating a FGameFuseAPIResponseCallback delegate and binding to it, then passing it to the API call.

Before:

UFUNCTION()
void OnGameSetup();

// In your code
GameFuseCore->SetUpGame("GameId", "Token");

After:

UFUNCTION()
void OnGameSetup(bool bSuccess, const FString& Response);

// In your code
FGameFuseAPIResponseCallback Callback;
Callback.BindDynamic(this, &YourClass::OnGameSetup);
GameFuseManager->SetUpGame("GameId", "Token", Callback);

5. Update Leaderboard Access

Leaderboards now hold a map of leaderboard names to leaderboard entries to allow for multiple leaderboards. GetLeaderboardEntries returns an Array of FGFLeaderboardEntry structs. Fetching is still 1 leaderboard at a time based on LeaderboardName.

Before:

TArray<UGameFuseLeaderboardItem*> Leaderboard = User->GetLeaderboards();

After:

const TMap<FString, FGFLeaderboard>& Leaderboards = Manager->GetLeaderboards();
const TArray<FGFLeaderboardEntry>& Entries = Manager->GetLeaderboardEntries("LeaderboardName");

Blueprint Changes

If you're using GameFuse in any blueprints, see the blueprint migration guide for instructions on updating your blueprints.

If you're familiar with Unreal C++, migrating Blueprints will be a breeze, check the TLDR in the migration guide for high level instructions. You can do it!

Common Issues and Solutions

Compile Errors with Old UObject Types

If you see compile errors related to UGameFuseStoreItem, UGameFuseLeaderboardItem, or other UObject types, replace them with their struct equivalents:

  • UGameFuseStoreItemFGFStoreItem
  • UGameFuseLeaderboardItemFGFLeaderboardEntry
  • UGameFuseUserFGFUserData

Missing Callback Responses

If your callbacks aren't being called, ensure you're: 1. Using the new delegate system 2. Binding the delegates before making the API call 3. Using the correct callback signature (FGFAPIResponse)