Please help, Error: Unrecognized type ‘FUniqueNetId’ - type must be a UCLASS, USTRUCT or UENUM

Hi,

Please help, i am new using c++ for unreal engine, i am trying to code log in with Epic Online Service and i get this error. Error: Unrecognized type ‘FUniqueNetId’ - type must be a UCLASS, USTRUCT or UENUM

my codes

// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

include “CoreMinimal.h”
include “Engine/GameInstance.h”
include “MyGameInstance_new_REM.generated.h”
include “OnlineSubsystem.h”
include “OnlineSubsystemTypes.h”

UCLASS()
class REM_API UMyGameInstance_new_REM : public UGameInstance
{
GENERATED_BODY()

UFUNCTION(BlueprintCallable, Category = "EOS Functions")
void UMyGameInstance_new_REM :: LoginWithEOS(FString ID, FString Token, FString LoginType);

/// @brief 
/// @param LocalUsernum 
/// @param bWasSuccess 
/// @param UserId 
/// @param Error 
UFUNCTION()
void UMyGameInstance_new_REM :: LoginWithEOS_Return(int32 LocalUsernum, bool bWasSuccess, const FUniqueNetId& UserId, const FString& Error);

};

// Copyright Epic Games, Inc. All Rights Reserved.

include “MyGameInstance_new_REM.h”
include “UObject/ConstructorHelpers.h”
include “OnlineSubsystem.h”
include “Interfaces/OnlineIdentityInterface.h”
include “OnlineSubsystemTypes.h”

void UMyGameInstance_new_REM ::LoginWithEOS(FString ID, FString Token, FString LoginType)
{
IOnlineSubsystem* SubsystemRef = Online::GetSubsystem(this->GetWorld());
if (SubsystemRef)
{
IOnlineIdentityPtr IdentityPointerRef = SubsystemrRef->GetIdentityInterface();
if (IdentityPointerRef)
{
FOnlineAccounrCredentials AccountDetails;
AccountDetails.Id = ID;
AccountDetails.Token = Token;
AccountDetails.Type = LoginType;
IdentityPointerRef->OnloginCompleteDelegates->AddUObject(this, &UEOS_GameInstance::LoginWith_EOS_Return);
IdentityPointerRef->Login(LocalUserNum 0, AccountDetails, );
}
}

}

void UMyGameInstance_new_REM ::LoginWithEOS_Return(int32 LocalUsernum, bool bWasSuccess, const FUniqueNetId& UserId, const FString& Error)
{
if (bWasSuccess)
{
UE_LOG(LogTemp,Warning,TEXT,(“Login Success”))
}
else
{
UE_LOG(LogTemp, Error, TEXT, ("Login Fail Reason - %s "), *Error);
}
}

Hi!

Try and add
#include "UObject/CoreOnline.h"
into your .h file.

Hi, Nikita, included it but i still get the same error.

this is the solution.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.