Hi, I've been trying to add C++ code to the UE4BPSDK that is provided. Namely, I am working with the ExampleProject created, and trying to incorporate some basic C++ code in to login using CustomID.
From here, I just copy and pasted the code into ExampleProjectGameMode::StartMatch
#include "PlayFabClientModels.h" void AExampleProjectGameMode::StartMatch() { // Create Request FClientLoginWithCustomIDRequest request; request.CustomId = "GettingStartedGuide"; request.CreateAccount = true; request.InfoRequestParameters = nullptr; // Set up Callbacks UPlayFabClientAPI::FDelegateOnSuccessLoginWithCustomID onSuccess; onSuccess.BindUFunction(this, "OnLoginOrRegister"); UPlayFabClientAPI::FDelegateOnFailurePlayFabError onError; onError.BindUFunction(this, "OnSharedError"); // Make API Call UPlayFabClientAPI* callObj = UPlayFabClientAPI::LoginWithCustomID(request, onSuccess, onError); // Extra activation step for UE BP callObj->Activate(); }
It said "PlayFabClientModels.h" not found, so I thought I had to add PlayFab to ExampleProject.Build.cs file to make it work.
// #define PF_UNREAL_OLD_4_14_TO_4_15 using UnrealBuildTool; public class ExampleProject : ModuleRules { #if PF_UNREAL_OLD_4_14_TO_4_15 public ExampleProject(TargetInfo Target) #else public ExampleProject(ReadOnlyTargetRules ROTargetRules) : base(ROTargetRules) #endif { PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "PlayFab" }); PrivateDependencyModuleNames.AddRange(new string[] { "PlayFab" }); // Uncomment if you are using Slate UI // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); // Uncomment if you are using online features // PrivateDependencyModuleNames.Add("OnlineSubsystem"); // if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) // { // if (UEBuildConfiguration.bCompileSteamOSS == true) // { // DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam"); // } // } } }
But it still didn't compile, and now it says Cannot open include file 'PlayFabPrivatePCH.h". The error is from "PlayFabEnums.h"
How do I use C++ code to login using CustomId, using UnrealBlueprintSDK?
Thanks