Hi, I am trying to create a function event that will fire when the Steam Game overlay is activated or deactivated,so I can pause the game play. However, I am trying to do the following, but it fails with the following error.
Error D:\Dropbox\MusicalRange-4.14\Intermediate\Build\Win64\UE4Editor\Inc\MusicalRange\MusicalRange.generated.cpp(608) : error C2512: ‘CCallback’: no appropriate default constructor available
Error D:\Dropbox\MusicalRange-4.14\Intermediate\Build\Win64\UE4Editor\Inc\MusicalRange\MusicalRange.generated.cpp(608) : note: see declaration of ‘CCallback’
Note that in the code I am skipping some functions that are not related to the problem.
#Header File
#include "ThirdParty/Steamworks/Steamv132/sdk/public/steam/steam_api.h"
#include "Engine/GameInstance.h"
#include "MusicalRangeInstance.generated.h"
UCLASS()
class MUSICALRANGE_API UMusicalRangeInstance : public UGameInstance
{
GENERATED_BODY()
private:
STEAM_CALLBACK(UMusicalRangeInstance, OnSteamOverlayActive, GameOverlayActivated_t, m_callGameOverlayActive);
public:
/*Constructor to be able to have STEAM_CALLBACKS build correctly*/
UMusicalRangeInstance();
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Steamworks")
bool IsSteamOverlayActive;
/*
* Must be called every frame so callbacks can be received
* Always Return True!
*/
UFUNCTION(BlueprintCallable, category = "Steamworks")
bool RunSteamCallbacks();
UFUNCTION(BlueprintImplementableEvent, Category = "Steamworks")
void OnSteamOverlayIsActive(bool isOverlayActive);
#CPP
#include "MusicalRange.h"
#include "MusicalRangeInstance.h"
UMusicalRangeInstance::UMusicalRangeInstance(FVTableHelper& Helper)
: Super(Helper),
m_callGameOverlayActive(this, &UMusicalRangeInstance::OnSteamOverlayActive) {
}
bool UMusicalRangeInstance::InterLevelPersitentValuePONE() {
InterLevelPersitentValue++;
return true;
}
bool UMusicalRangeInstance::RunSteamCallbacks() {
SteamAPI_RunCallbacks();
return true;
}
void UMusicalRangeInstance::OnSteamOverlayActive(GameOverlayActivated_t *pParam) {
if (pParam->m_bActive != 0)
{
IsSteamOverlayActive = true;
}
else
{
IsSteamOverlayActive = false;
}
OnSteamOverlayIsActive(IsSteamOverlayActive);
return;
}
I have looked at this other threads, where the generated file fails to compile the code when projects migrated from 4.7 to 4.8. I have tried a bunch of combinations but they all fail to compile, some with more errors than others. This set up is what yields the least errors, and is only at the generated cpp file.
Thanks.