How to find Online Sessions in Crossgen SDK

Hi! I’ve been trying to make online sessions work for a while now and I’m stuck with some things.

After a lot of research I found some kind of “guides” about how to look for a session and I was trying to use this code in the OnlineSessionInterfaceCrossgen.cpp file (as Find Sessions is not implemented in this script) and everything seems ok in most things, but when I try to build the project I get this error message:

"assigning to ‘FDelegateHandle(FOnlineSessionCrossgen::*)(bool)’ from incompatible type ‘FDelegateHandle’ "

My handles are:

FDelegateHandle OnFindSessionsCompleteDelegateHandle;

// The delegate executed by the online subsystem
FOnFindSessionsCompleteDelegate FindSessionsCompleteDelegate;

and the FindSessions code is:

bool FOnlineSessionCrossgen::FindSessions(const FUniqueNetId& SearchingPlayerId, const TSharedRef<FOnlineSessionSearch>& SearchSettings)
{
	UE_LOG_ONLINE(Log, TEXT("Implementing FindSessions for PS5"));

	FOnlineAsyncTaskGetSessionByIdComplete TaskCompletionDelegate;
	SessionSearchSettings = SearchSettings;

	IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();
	if (OnlineSub) {
		IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();

		if (Sessions.IsValid() && SearchingPlayerId.IsValid()) {
			FDelegateHandle(FOnlineSessionCrossgen::* OnFindSessionsCompleteDelegateHandle)(bool);

			//FindSessionsCompleteDelegate = (FOnFindSessionsCompleteDelegate::CreateUObject(this, &FOnlineSessionCrossgen::OnFindSessionsComplete));
			OnFindSessionsCompleteDelegateHandle = Sessions->AddOnFindSessionsCompleteDelegate_Handle(FindSessionsCompleteDelegate);
			Sessions->FindSessions(SearchingPlayerId, SessionSearchSettings);

		}
	}
	else {
		FOnlineSessionCrossgen::OnFindSessionsComplete(false);
	}
	
	return true;
}

I’ve already created the handle in the constructor (that’s why it’s commented in the function), this error message comes from the line

OnFindSessionsCompleteDelegateHandle = Sessions → AddOnFindSessionsCompleteDelegate_Handle…

Is there something I’m doing wrong or missing in this?

Thanks a lot to anyone who can offer some light to this

To anyone nterested, I’ve managed to fix the specific build error issue by changing the assign delegate line by declaring the handle in the same function.

FDelegateHandle findSessionsCompleteDelegateHandle = Sessions->AddOnFindSessionsCompleteDelegate_Handle(FindSessionsCompleteDelegate);

The build finished succesfully, but it crashed on startup because of the TSharedRef variable, it seems that one cannot use a variable of this kind as part of a class, the game crashed when it got to the constructor of this class. I tested different things and changed the variable to a TSharedPtr, but whenever I get to the line that sends the FindSessions message (Sessions->FindSessions(SearchingPlayerId, SessionSearchSettings); ) the game crashes, I’m still trying to figure out what is happening here and how I can work around this, if anyone has any clue or solution, I would love to be pointed in the right direction