C++ Unrecognized Type Error when Creating a Struct

My header EOSSessionStructs.h is this

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "OnlineSessionSettings.h"
#include "EOSSessionStructs.generated.h"

USTRUCT(BlueprintType)
struct FJoinableSessionResult
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "EOS Sessions")
	FOnlineSessionSearchResult SessionResult;  // <----- this line gives the error

	UPROPERTY()
		UObject* SafeObjectPointer;
};

and it gives the error

error : Unrecognized type 'FOnlineSessionSearchResult' - type must be a UCLASS, USTRUCT, UENUM, or global delegate.

and my Build.cs file is

		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "OnlineSubsystem", "OnlineSubsystemEOS" });

		PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem" });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		PrivateDependencyModuleNames.Add("OnlineSubsystem");

I read other topics similar to this about manually including the header #include “OnlineSessionSettings.h”, but I’m not entirely sure how to get mine to work.

Please help :pray:

You can see the include & module in the documentation.

You need to type
#include “OnlineSessionSettings.h”
above
#include “EOSSessionStructs.generated.h”

The FOnlineSessionSearchResult class is not a UCLASS in the engine. It cannot be exposed to blueprints. You can work around this by storing the native search result in your struct, and either exposing data through UPROPERTY variables, or creating functions e.g. GetNumPlayers, GetOwningUsername, and then creating blueprint exposed versions of those functions in a BlueprintFunctionLibrary for example.

Hi 3dRaven, I did have that, but it doesn’t seem to work.

@STRiFE.x thanks so much. I never thought about just storing it and exposing it’s info another way.